class Human: def _init_(self, n, o) self.name = n self.occupation = o
def do_work(self): if self.occupation== 'tennis player': print(self.name, 'plays tennis') elif self.occupation == 'actor': print(self.name, 'shoots film') def speaks(self): print(self.name, 'how are you') tom = Human('tom cruise', 'actor') tom.do_work() tom.speak() Traceback most recent call last File "c:\users\shaun\python\python35\human_class.py"line 16 in module tom =Human('tom cruise', 'actor') TypeError: object() takes no parameters how to fix this?why it happens? this happens whenever i try to do class,this is from a tutorial _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor