Challenge
Note
Private methods and attributes of the parent class are not available in the child's class.
The Animal
class:
1234567class Animal: def __init__(self, name = None, age = None): self.__name = name self.__age = age def move(self): print('Animal is moving...')
Aufgabe
Swipe to start coding
- Create a class
Cat
that inherits theAnimal
class. - Create the
eat
method. - Create a
5
kg10
years old'Lola'
cat. - Move the cat (using the
move()
method from theAnimal
class). - 'Feed' the cat (using the
eat()
method from theCat
class).
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 3. Kapitel 2
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Zusammenfassen Sie dieses Kapitel
Code in file erklären
Erklären, warum file die Aufgabe nicht löst
Awesome!
Completion rate improved to 7.69
Challenge
Swipe um das Menü anzuzeigen
Note
Private methods and attributes of the parent class are not available in the child's class.
The Animal
class:
1234567class Animal: def __init__(self, name = None, age = None): self.__name = name self.__age = age def move(self): print('Animal is moving...')
Aufgabe
Swipe to start coding
- Create a class
Cat
that inherits theAnimal
class. - Create the
eat
method. - Create a
5
kg10
years old'Lola'
cat. - Move the cat (using the
move()
method from theAnimal
class). - 'Feed' the cat (using the
eat()
method from theCat
class).
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 3. Kapitel 2
single