Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RemoteControl:
- def __init__(self):
- self.ID = None
- self.power = None
- self.battery = None
- self.antenna = None
- def move(self, p):
- self.send(p)
- def send(self, signal):
- print(f"{self.ID}: Сигнал {signal} отправлен")
- self.battery -= 1
- def info(self):
- print(self.__dict__)
- class HelicopterRC(RemoteControl):
- def __init__(self, ID):
- super().__init__()
- self.ID = ID
- self.power = True
- self.battery = 100
- self.antenna = True
- def fly(self, p):
- self.send(f"fly: {p}")
- class AutoRC(RemoteControl):
- def __init__(self, ID):
- super().__init__()
- self.ID = ID
- self.power = True
- self.battery = 90
- def lights_on(self):
- self.send(f"lights: {True}")
- class TV_RC(RemoteControl):
- def __init__(self, ID):
- super().__init__()
- h = HelicopterRC("12F")
- h.battery -= 42
- h.info()
- h.move(-100)
- h.fly(900)
- print()
- h2 = HelicopterRC("59T")
- h2.antenna = False
- h2.info()
- h2.move(50)
- h2.fly(-50)
- h2.info()
- print()
- auto = AutoRC("44K")
- auto.info()
- auto.lights_on()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement