Пример #1
0
from tesla import Tesla
from ram import Ram
from cessna import Cessna
from zero import Zero
# my_tesla = Tesla()

# my_tesla.main_color = "blue"

# print(my_tesla.main_color)

fxs = Zero()
modelS = Tesla()
mx410 = Cessna()
dodgeRam = Ram()

fxs.drive()
modelS.drive()
mx410.drive()
dodgeRam.drive()
Пример #2
0
from acura import Acura
from fiat import Fiat
from jeep import Jeep
from lamborghini import Lamborghini
from tesla import Tesla

acura = Acura("gray")
fiat = Fiat("golden")
jeep = Jeep("red")
lamborghini = Lamborghini("yellow")
tesla = Tesla("blue")

acura.drive()
acura.turn("right")
acura.stop()
print()
fiat.drive()
fiat.turn("left")
fiat.stop()
print()
jeep.drive()
jeep.turn("right")
jeep.stop()
print()
lamborghini.drive()
lamborghini.turn("left")
lamborghini.stop()
print()
tesla.drive()
tesla.turn("right")
tesla.stop()
Пример #3
0
from zero import Zero
from cessna import Cessna
from ram import Ram
from tesla import Tesla

fxs = Zero()
fxs.main_color = "red"
fxs.drive()
fxs.turn("right")
fxs.stop()

modelS = Tesla()
modelS.main_color = "green"
modelS.drive()
modelS.turn("left")
modelS.stop()

mx410 = Cessna()
mx410.main_color = "white"
mx410.drive()
mx410.turn("right")
mx410.stop()

ram1500 = Ram()
ram1500.main_color = "orange"
ram1500.drive()
ram1500.turn("left")
ram1500.stop()
Пример #4
0
def test_color_check():
    # CHECK IF TESLA HAS RIGHT COLOR
    new_car = Tesla("3", "red")
    assert new_car.color == "red"
Пример #5
0
def test_seats_change():
    # TRIES TO UNLOCK TESLA
    new_car = Tesla("3", "red")
    new_car.seats_count = 6
    assert new_car.seats_count == 6
deans_car = Baby("black", 6, "gasoline", "Chevy", "Impala",
                 "Weapons depot in trunk.")

wayne_tech = Batmobile("black", 2, "gasoline", "Chevy", "Batmobile",
                       "All of them.")

who_you_gonna_call = Ecto1("white", 4, "gasoline", "Futura Duplex", "Cadillac",
                           "Gunner seat, y'all!")

turtle_power = Party_Wagon("yellow", 8, "gasoline", "Volkswagen", "Bus",
                           "Pizza launcher.")

mustang_sally = Mustang("cherry red", 5, "gasoline", "Ford", "Mustang", 1965)

starman = Tesla("red", 5, "electricity", "Tesla", "Roadster",
                "It's in friggin' space!")

# for key, value in deans_car.__dict__.items():
#     print(f'{key}: {value}\n')

# deans_car.drive()
# deans_car.turn("left")
# deans_car.stop()

# for key, value in wayne_tech.__dict__.items():
#     print(f'{key}: {value}\n')

# wayne_tech.drive()
# wayne_tech.turn("right")
# wayne_tech.stop()
Пример #7
0
# car1 = Vehicle("Porsche", "Black", 140)
# car2 = Vehicle("Jaguar", "Gray", 100)
# car3 = Vehicle("Audi", "Red", 110)
# car4 = Vehicle("BMW", "White", 120)
# car5 = Vehicle("Subaru", "Blue", 200)

# Create a drive() method in the Vehicle class.
# Override the drive() method in all the other vehicle classes. Include the vehicle's color in the message (i.e. "The blue Ram drives past. RRrrrrrummbbble!").

# Create a turn(self, direction) method, and a stop(self) method on Vehicle. Define a basic implementation of each.

# Override all three of those methods on some of the vehicles. For example, the stop() method for a plane would be to output the message "The white Cessna rolls to a stop after rolling a mile down the runway."
# Make your vehicle instances perform all three behaviors.

model_s = Tesla()
fxs = Zero()
mx410 = Cessna()
e350 = MB()

model_s.drive()
fxs.drive()
mx410.drive()
e350.drive()

fxs.turn("left")
fxs.stop()

e350.turn("left")
fxs.stop()