Why am i am not getting name printed ?
like maika,kritika,raman
class Person:
def init(self,name,age):
self.name=name
self.age=age
def lt(self,other):
return self.age<other.age
def str(self):
return str(self.name)
def insertion(people):
for i in range(len(people)):
j=i
while j>0 and people[j-1]>people[j]:
people[j-1],people[j]=people[j],people[j-1]
j=j-1
if name=='main':
people=[Person('raman',25),Person('kritika',23),Person('maika',1)]
print(people)
Voters
Solution
you need to print the actual function. Try this
like that.
That should work
@RYANTADIPARTHI Thank you for taking the time to reply :)because of you I tried again ,but people.str is not solution,what worked is:-
for item in people:
print(item)
thanks again :)
@KritikaAsreth oh ok