Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
class something():
x=5
obj=something()
print(obj.x)
5
class some():
def __init__(self,name,age):
self.name=name
self.age=age
obj=some("iti",21)
obj1=some("Tanu",21)
print("obj1:",obj1.name)
print("obj",obj.name)
print(obj1.age)
print(obj.age)
class some():
li=[]
def __init__(self,phy,chem):
self.phy=phy
self.chem=chem
def total(self,obj):
self.sum=obj.phy+obj.chem
return self.sum
a=[]
for i in range(0,2):
obj=some(int(input()),int(input()))
a.append(obj)
count=1
for i in range(0,2):
sum=a[i].total(a[i])
print("The total Marks are",sum)
print("The Marks of student",i+1,"are:")
print("Physics",a[i].phy)
print("Chemistry",a[i].chem)
count=count+1
34
56
56
67
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-85eb05d3436b> in <module>
15 for i in range(0,2):
16 obj=a[i].total(a[i])
---> 17 print(obj.arr)
18 # print("The total Marks are",sum)
19 print("The Marks of student",i+1,"are:")
AttributeError: 'NoneType' object has no attribute 'arr'
for i in [1,2,3]:
print(i)
1
2
3
a=lambda v,n : 12+n
print(a(int(input()),int(input())))
34
23
35