-
Notifications
You must be signed in to change notification settings - Fork 0
/
car.py
33 lines (31 loc) · 825 Bytes
/
car.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
class Car(object):
def __init__(self,name='General',model='GM',car_type='honda'):
self.car_type = car_type
self.model = model
self.name = name
self.speed = 0
if name=='Porshe' or name=='Koenigsegg':
self.num_of_doors = 2
else:
self.num_of_doors = 4
if car_type=='trailer':
self.num_of_wheels = 8
else:
self.num_of_wheels = 4
def doors(self, num_of_doors):
pass
def drive(self, moving_man):
return moving_man
def drive(self, spid):
if self.car_type=='trailer':
self.speed = spid*11
else:
self.speed = 10**spid
return self
def wheels(self, num_of_wheels):
return num_of_wheels
def is_saloon(self):
if self.car_type=='trailer':
return False
else:
return True