Nov-03-2019, 05:21 AM
So i was reading the Python Tutorial and decided to follow one of it's code :
a = Cat('Kelly')
a.add_trick('sit')
but this is what i got:
class Cat: def __init__(self, name): self.name = name self.tricks = [] def add_trick(self, trick): self.tricks.append(trick)then i put this in the console :
a = Cat('Kelly')
a.add_trick('sit')
but this is what i got:
Error:File "<stdin>", line 1, in <module>
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36-32\lib\cat.py", line 7, in add_trick
self.tricks.append(trick)
can anyone tell why did this happen? If there's a mistake in the code, please tell the solution