[Tutor] Object takes no parameters
Howard Lawrence
1019shaun at gmail.com
Wed Aug 16 20:08:47 EDT 2017
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
More information about the Tutor
mailing list