Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bird:
- def __init__(self, color: str = "Белые", age: int = 0, canFly: bool = "true", emotion: int = 50):
- self.color = color
- self.age = age
- self.canFly = canFly
- self.emotion = emotion
- def setAge(self, age: int):
- self.age = age
- def setColor(self, color: str):
- self.color = color
- def walk(self):
- print("Ходит")
- def fly(self):
- if self.canFly:
- if self.emotion < 30:
- print("Птичка в шоковом состоянии, она сейчас не может летать")
- elif self.emotion < 50:
- print("Птичке сейчас плохо, она сейчас не может летать")
- elif self.emotion < 70:
- print("Птичке хорошо! Она сейчас взлетит!")
- elif self.emotion <= 100:
- print("Птичке отлично! Она взлетает!")
- else:
- print("Птичка не умеет летать")
- class Оstrich(Bird):
- def __init__(self, color: str = "Чёрные", age: int = 0, maxSpeed: float = 50, emotion: int = 70):
- super.__init__(color, age, False, emotion)
- self.maxSpeed = maxSpeed
- def sprint(self):
- print("Сейчас птица идёт со скоростью "+str(self.maxSpeed)+" км/ч")
- class Pinguen(Bird):
- def __init__(self, color: str = "Серый", age: int = 3, eating: bool = False, emotion: int = 70):
- super.__init(color, age, False, emotion)
- self.eating = eating
- def eating(self):
- if self.eating:
- print("Пингвин кушает")
- else:
- print("Пингвин не голодный")
- # color: str = "Белые", age: int = 0, canFly: bool = True, emotion: int = 50
- class pigeon(Bird):
- def __init__(self, color: str = "Чёрные", age: int = 0, maxSpeed: float = 10, emotion: int = 50):
- super.__init__(color, age, False, emotion)
- self.maxSpeed = maxSpeed
- def maxSpeed(self):
- print("У вашего голубя максимальная скорость "+str(self.maxSpeed))+" км/ч"
- golub = pigeon("Белый", 5, 3.3, 50)
- print(golub.maxSpeed())
Advertisement
Add Comment
Please, Sign In to add comment