So I have list of objects in class and I need to print all different songs from one singer. So far I have this code and I am not sure is it correct
Also I need to use recursion method
def allmusic(listofobjects, name):
nameandsurname=self.name
if(listofobjects.name==nameandsurname):
print(listofobjects.music)
return(listofobjects(music[1:]))
else:
return(listofobjects(name[1:]))
Also I need to print number of singers in that class and code I have is
def allmusic(listofobjects):
numberofsingers=0
for s in listofobjects:
numberofsingers+=1
return(listofobjects()[1:])
print(numberofsingers)
selfsupposed to refer to in the first attempt? What do the elements of the input list look like?