Guest

Untitled 1556

Apr 24th, 2026
9
0
Never
Not a member of GistPad yet? Sign Up, it unlocks many cool features!
None 1.98 KB | None | 0 0
  1. class Vehicle:
  2. def __init__(self, brand: str, max_speed: int):
  3. self.brand = brand
  4. self.max_speed = max_speed
  5.  
  6. def info(self) -> str:
  7. return f"{self.brand}, макс. скорость {self.max_speed} км/ч"
  8.  
  9.  
  10. class Car(Vehicle):
  11. def __init__(self, brand: str, max_speed: int, doors: int):
  12. super().__init__(brand, max_speed)
  13. self.doors = doors
  14.  
  15. def info(self) -> str:
  16. return f"Авто {self.brand}, {self.doors} двери, {self.max_speed} км/ч"
  17.  
  18.  
  19. class Bike(Vehicle):
  20. def __init__(self, brand: str, max_speed: int, bike_type: str):
  21. super().__init__(brand, max_speed)
  22. self.bike_type = bike_type
  23.  
  24. def info(self) -> str:
  25. return f"Велосипед {self.brand}, тип: {self.bike_type}, {self.max_speed} км/ч"
RAW Paste Data Copied