TypeError: Dog() не принимает аргументов

Где ошибка? Все сделал так же, как в видеоуроке / книге, ошибки не выдает. Может быть, конечно есть другая версия питона. В чем моя ошибка?

class Dog():
    """Simple dog model"""

    def _init_(self,name, age):
        """Initialize attributes, name and age"""
        self.name = name
        self.age = age
        """Dog created"""
        def sit(self):
            """The dog will sit down on command"""
            print(self.name.title()+ " the dog sat down")


        def jump():
            """The dog will jump on command"""
            print(self.name.title()+" the dog jumped")


my_dog = Dog()
print(my_dog.name)

Я получил:

Traceback (most recent call last):
  File "C:/Users/Professional/PycharmProjects/thebasics/exmplclass.py", line 22, in <module>
    my_dog = Dog('topik',5)
TypeError: Dog() takes no arguments
Process finished with exit code 1

0 ответов

Другие вопросы по тегам