Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Car():
- counter1 = 0
- brand = ""
- model = ""
- engine_type = ""
- horse_power = 0
- def __init__(self, brand, model, engine_type, horse_power):
- print("Creating object Car")
- self.counter2 = 9
- Car.counter1 += 1
- self.brand = brand
- self.model = model
- self.engine_type = engine_type
- self.horse_power = horse_power
- def display(self):
- print(self.brand)
- print(self.model)
- print(self.engine_type, self.horse_power)
- print(Car.counter1)
- car1 = Car("Ford", "Focus", "Diesel", 180)
- print(Car.counter1)
- car2 = Car("Mazda", "6", "Diesel", 240)
- print(Car.counter1)
- print(car1.counter2)
- print(car2.counter2)
Add Comment
Please, Sign In to add comment