def main(): """Demo test code to show how to use car class.""" my_car = Car("First car", 180) my_car.drive(30) print("fuel =", my_car.fuel) print("odo =", my_car.odometer) print(my_car) print("Car {}, {}".format(my_car.fuel, my_car.odometer)) print("Car {self.fuel}, {self.odometer}".format(self=my_car)) # 1 limo = Car(100) # 2 limo.add_fuel(20) # 3 print("fuel =", limo.fuel) # 4 limo.drive(115) # 5 print("odo =", limo.odometer) # 6 - added to car.py print(limo) # 7 limo.name = "Limo" limo.fuel = 120 # 8 print(limo)
def main(): """Demo test code to show how to use car class.""" my_car = Car(180) my_car.drive(30) my_car.name = "Car" print("Car fuel =", my_car.fuel) print("Car odo =", my_car.odometer) print(my_car) # print("Car {}, {}".format(my_car.fuel, my_car.odometer)) # print("Car {self.fuel}, {self.odometer}".format(self=my_car)) my_limo = Car(100) my_limo.fuel += 20 my_limo.name = "limo" print("Limo fuel =", my_limo.fuel) my_limo.drive(115) print("Limo odo =", my_limo.odometer) print(my_limo)
def main(): """Demo test code to show how to use car class.""" # my_car = Car(120) # my_car.drive(30) my_limo = Car(100) my_limo.add_fuel(20) my_limo.drive(115) # print("fuel =", my_limo.fuel) my_limo.name = "Fancy Limo" print(my_limo)