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)
Exemple #2
0
    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)
Exemple #4
0
#when importing
#looks first in current working directory
#this folder basically.
#  import classes #don't have to write .py part

#if not in your current- it looks in a folder place where all the packages and where
#all the pip stuff comes from..
#unless told look somewhere else

#you can also import only parts of it.

from classes import wheel, engine, body
#from classes import * #imports all

tire = wheel(18)
print(tire.size)

camry_eng = engine(180, 4)
print(camry_eng.horsepower)
print(f"my car's engine has: {camry_eng.cylinders} cylinders")

camry_body = body("silver")  #, num_doors=5)
print(camry_body.boot_size)