forked from CIT-PROJECTS-2021/cit-cohort-three
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht.py
43 lines (29 loc) · 957 Bytes
/
t.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 Vehicle:
def __init__(self, name, color):
self.name = name
self.color = color
def __str__(self):
return f"{self.name} is {self.color}"
def move(self):
print(f"{self.name} is moving at 100km/h")
class Car:
def __init__(self, name, color, model):
self.name = name
self.color = color
self.model = model
def __str__(self):
return f"{self.name} is {self.color} and it is a {self.model}"
def move(self):
print(f"{self.name} is moving")
class HomeCar(Vehicle, Car):
def __init__(self, name, color, model, year):
super().__init__(name, color)
self.model = model
self.year = year
def __str__(self):
return f"{self.name} is {self.color} and it is a {self.model} and it was made in {self.year}"
def move(self):
return super().move()
car = HomeCar("Toyota", "Red", "Camry", 2010)
print(car)
car.move()