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...')
Tarea
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).
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 3. Capítulo 2
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Suggested prompts:
Resumir este capítulo
Explicar el código en file
Explicar por qué file no resuelve la tarea
Awesome!
Completion rate improved to 7.69
Challenge
Desliza para mostrar el menú
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...')
Tarea
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).
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Awesome!
Completion rate improved to 7.69Sección 3. Capítulo 2
single