0

why not return lec students name?

class student: def __init__(self,*name): self.name=list(name) def stud(self): return self.name stu=student("david","nick") print(stu.stud()) class lector(student): def st(self): return self.name lec=lector() print(lec.st())

23rd Jun 2019, 2:48 PM
kokito
1 ответ
+ 1
It's because you didn't pass any name when you created the lec object. If you had done lec = lector("david", "nick") print(lec.st()) would return ["david", "nick"] You did create the object stu, but there's nothing that associates lec with stu.
23rd Jun 2019, 4:01 PM
Russ
Russ - avatar