Exemplo n.º 1
0
def test():
    car = Car("DaZhong", "module_1", 2016)
    print(car.get_descriptive_name())  # Dazhong,Module_1,2016

    electric_car = ElectricCar("DaZhong", "module_1", 2016)
    print(electric_car.get_descriptive_name())  # Dazhong,Module_1,2016

    electric_car.desc_battery()  # 70-kwh battery

    car.desc_type()  # Car
    electric_car.desc_type()  # Electric Car

    electric_car.battery.desc_battery()  # 70-kwh battery
Exemplo n.º 2
0
# Page 181
# Импортирование модуля в модуль

from basic_car import Car
from electric_car import ElectricCar

my_beetle = Car('volkswagen', 'beetle', 2016)
print(my_beetle.get_descriptive_name())
# 2016 Volkswagen Beetle

my_tesla = ElectricCar('tesla', 'roadster', 2016)
print(my_tesla.get_descriptive_name())
# 2016 Tesla Roadster
Exemplo n.º 3
0
from car import Car
from electric_car import ElectricCar

my_beetle = Car('volkswagen', 'beetle', 2015)
print(my_beetle.get_descriptive_name())

my_tesla = ElectricCar('tesla', 'roadster', 2015)
print(my_tesla.get_descriptive_name())
Exemplo n.º 4
0
from electric_car import Car, ElectricCar

my_beetle = Car('volkswagen','beetle',2019)
my_beetle.get_descriptive_name()

my_tesla = ElectricCar('tesla','roadster',2019)
my_tesla.get_descriptive_name()

# my_battery = Battery()
Exemplo n.º 5
0
from car import Car
from electric_car import ElectricCar

my_new_car = Car('bmw', 'm3', 2018)

print(my_new_car.get_descriptive_name())

my_new_elcar = ElectricCar('Tesla', 'Roadster', 2016)

print(my_new_elcar.get_descriptive_name())
Exemplo n.º 6
0
from electric_car import ElectricCar
from electric_car import Battery
"""
from electric_car import Car

my_new_car = Car('audi', 'a4', 2016)
print(my_new_car.get_descriptive_name())
my_new_car.odometer_reading = 23
my_new_car.read_odometer()
"""
battery = Battery()
new_my_el_car = ElectricCar('hz', 'r', 2011, battery=battery)
print(new_my_el_car.get_descriptive_name())

new_my_el_car.battery.get_range()
new_my_el_car.battery.upgrade_battery(240)
new_my_el_car.battery.get_range()
Exemplo n.º 7
0
from car import Car
from electric_car import ElectricCar

my_beetle = Car('volswagen', 'beetle', 2015, 9800)

my_tesla = ElectricCar('tesla', 'roadster', '2016', 970)

my_beetle.get_descriptive_name()

my_tesla.get_descriptive_name()

my_tesla.battery.about_battery()
Exemplo n.º 8
0
from electric_car import ElectricCar

my_car = ElectricCar('toyota', 'prius', '2019')

print(my_car.get_descriptive_name())

my_car.odometer_reading = 23
my_car.read_odometer()

my_car.battery.describe_battery()
my_car.battery.upgrade_battery()
my_car.battery.describe_battery()
Exemplo n.º 9
0
##Importing the Car,Electric class

from car import Car

from electric_car import ElectricCar

my_car = Car('volkswagen', 'a4', 2019)

my_car.get_descriptive_name()

my_electric_car = ElectricCar('tesla', 'x5', 2019)

my_electric_car.get_descriptive_name()
Exemplo n.º 10
0
from car import Car
from electric_car import ElectricCar

mondeo = Car("Ford", "Mondeo", 2017)
mondeo.get_descriptive_name()
prius = ElectricCar("Toyota", "Prius", 2012)
prius.get_descriptive_name()
prius.battery.describe_battery()
prius.battery.get_range()
Exemplo n.º 11
0
from electric_car import ElectricCar

new_ecar = ElectricCar("tesla", "model s", 2016, 21)

new_ecar.get_descriptive_name()

new_ecar.update_odometer(26)

new_ecar.battery.about_battery()

new_ecar.battery.get_range()

new_ecar.battery.upgrade_bat()

new_ecar.battery.get_range()