View difference between Paste ID: k6xcWUBF and 7ku4B8W2
SHOW: | | - or go back to the newest paste.
1
class Car():
2
    counter1 = 0
3
    brand = ""
4
    model = ""
5
    engine_type = ""
6
    horse_power = 0
7
8
    def __init__(self, brand, model, engine_type, horse_power):
9
        print("Creating object Car")
10
        self.counter2 = 9
11
        Car.counter1 += 1
12
        self.brand = brand
13
        self.model = model
14
        self.engine_type = engine_type
15
        self.horse_power = horse_power
16
17
    def display(self):
18
        print(self.brand)
19
        print(self.model)
20
        print(self.engine_type, self.horse_power)
21
22
23
print(Car.counter1)
24
car1 = Car("Ford", "Focus", "Diesel", 180)
25
print(Car.counter1)
26
car2 = Car("Mazda", "6", "Diesel", 240)
27
print(Car.counter1)
28
print(car1.counter2)
29
print(car2.counter2)
30
31