-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmycar.py
44 lines (33 loc) · 994 Bytes
/
mycar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Car:
def __init__(self):
self.engine = False
def startEngine(self):
if self.engine == False :
print("starting engine")
self.engine = True
else:
print("the engine is already running")
def stopEngine(self):
if self.engine == True:
print("stopping engine")
self.engine = False
else:
print("the engine is already off")
def drive(self):
if self.engine == True:
print("driving the car!")
else:
print("the engine needs to be started first")
def status(self):
print("Color: " + self.color)
print("Model: " + self.model)
print("The engine is " + str(self.engine))
class BlueCar:
color = 'Blue'
class Honda(Car, BlueCar):
make = "Honda"
def startEngine(self):
super().startEngine()
print("Starting the Honda engine!")
class HondaCivic(Honda):
model = 'Civic'