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...')
Taak
Swipe to start coding
- Create a class
Catthat inherits theAnimalclass. - Create the
eatmethod. - Create a
5kg10years old'Lola'cat. - Move the cat (using the
move()method from theAnimalclass). - 'Feed' the cat (using the
eat()method from theCatclass).
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 2
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 7.69
Challenge
Veeg om het menu te tonen
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...')
Taak
Swipe to start coding
- Create a class
Catthat inherits theAnimalclass. - Create the
eatmethod. - Create a
5kg10years old'Lola'cat. - Move the cat (using the
move()method from theAnimalclass). - 'Feed' the cat (using the
eat()method from theCatclass).
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 2
single