Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Дз от 09.10.2024г.
- #1)
- class Mammal:
- def give_birth(self):
- return 'Я даю жизнь'
- class Flying:
- def fly(self):
- return 'Я летаю'
- class Bat(Mammal, Flying):
- def give_birth_bat(self):
- return 'Я летучая мышь, я даю жизнь'
- """Создание экземпляра"""
- Bat1 = Bat()
- """Тестирование классов"""
- print(Bat1.give_birth_bat())
- print(Bat1.give_birth())
- print(Bat1.fly())
- #2)
- class Robot:
- def power_on(self):
- return 'Робот включён'
- class Solider:
- def fight(self):
- return 'Солдат сражается'
- class BattleRobot(Robot, Solider):
- def power_on_br(self):
- return 'Боевая машина включена'
- Robot1 = BattleRobot()
- print(Robot1.power_on())
- print(Robot1.fight())
- print(Robot1.power_on_br())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement