Exemplo n.º 1
0
import car
from electric_car import ElectricCar

my_car = car.Car('bwm', 'sl', 2019)
print(my_car.get_description_name())
my_car.read_odometer()
print()

my_electric_car = ElectricCar('tesla', 'model s', 2019)
print(my_electric_car.get_description_name())
my_electric_car.read_odometer()
Exemplo n.º 2
0
"""
主函数
"""

from car import Car
from electric_car import ElectricCar

my_tesla = ElectricCar("tesla", "model s", 2018)

print(my_tesla.get_description_name())
my_tesla.battery.describe_battery()
my_tesla.battery.get_range()

my_tesla.update_odometer(90)
my_tesla.read_odometer()