-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (28 loc) · 838 Bytes
/
test.py
File metadata and controls
32 lines (28 loc) · 838 Bytes
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
# class Vehicle:
# def __init__(self, wheels, color):
# self.wheels = wheels
# self.color = color
# class Car(Vehicle):
# def __init__(self, wheels, color, gears):
# super().__init__(wheels, color)
# self.gears = gears
# def gear_info(self):
# return (f"{self.color} Car has {self.gears} gears")
#
# honda = Vehicle(wheels=2, color="White")
# honda_car = Car(wheels=4, color="Black", gears= 6)
# print(honda.color, honda.wheels)
# print(honda_car.color, honda_car.wheels)
# print (honda_car.gear_info())
class Vehicle:
def __init__(self):
self.wheels = 2
self.color = "Black"
class Car(Vehicle):
def __init__(self):
super().__init__()
self.wheels = 4
bike = Vehicle()
car = Car()
print (bike.color , bike.wheels)
print (car.color, car.wheels)