def __init__(self, horsepower, cylinders, color, w_size=18, num_doors=4): self.engine = engine(horsepower, cylinders) self.front_right_wheel = wheel(w_size) self.front_left_wheel = wheel(w_size) self.back_right_wheel = wheel(w_size) self.back_left_wheel = wheel(w_size) self.body = body(color, num_doors)
def __init__(self, horsepower, cylinders, color, w_size=18, num_doors=4): #make the engine of the vehicle self.engine = engine(horsepower, cylinders) #make the tires of the vehicle self.front_right_wheel = wheel(w_size) self.front_left_wheel = wheel(w_size) self.back_right_wheel = wheel(w_size) self.back_left_wheel = wheel(w_size) #make the body of te vehicle self.body = body(color, num_doors)
from classes import wheel, engine, body #from classes import * tire = wheel(18) print(tire.size) camry_eng = engine(180, 4) print(camry_eng.horsepower) print(f"My car has {camry_eng.n_cylinders}") camry_body = body("silver") print(camry_body.trunk_size)
from classes import wheel, engine, body #from classes import * tire = wheel(18) print(tire.size) camry_eng = engine(180, 4) #180 horsepower and 4 cylinders print(camry_eng.horsepower) print(f"My car's engine has {camry_eng.n_cylinders} cylinders.") #call the attribute from classes.py by typing {camry_eng.____} camry_body = body("silver") print(camry_body.trunk_size)