from car import ElectricCar my_tesla=ElectricCar("tesla","model s",2018) print(my_tesla.descriptive_name()) my_tesla.battery.descriptive_battery() my_tesla.battery.get_range()
#HOW TO IMPORT CLASS MODULES from car import ElectricCar new_car = ElectricCar("ford", "m21", 2021) print("My new car is :", new_car.descriptive_name()) print("-----------------------------") #Importing multiple Classes from a Module from car import Car, ElectricCar my_vaulks = Car("vaulks", "chasis", 2015) print(my_vaulks.descriptive_name()) new_car = ElectricCar("ford", "m21", 2021) print("My new car is :", new_car.descriptive_name()) print("-----------------------------") #To import all Classes in a module(eg in car.py) from car import * #Though not usually recommended #To import an Entire module(eg car.py) import car #page 216 - importing a module in a module eg. from car import Car from pizza import make_pizza #exercise pg 199 class Restaurant(): def __init__(self, restaurant_name, cuisine_type): '''Initialize restaurant_name and cuisine_type'''