-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThings.py
More file actions
58 lines (51 loc) · 1.34 KB
/
Things.py
File metadata and controls
58 lines (51 loc) · 1.34 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class Things:
pass
class Inanimate(Things):
pass
class Animate(Things):
pass
class Sidewalks(Inanimate):
pass
class Animals(Animate):
def breathe(self):
print('breathing')
def move(self):
print('moving')
def eat_food(self):
print('eating food')
class Mammals(Animals):
def feed_young_with_milk(self):
print('feeding young')
class Giraffes(Mammals):
def eat_leaves_from_trees(self):
self.eat_food()
def find_food(self):
self.move()
print("I've found food!")
self.eat_food()
def dance_a_jig(self):
self.move()
self.move()
self.move()
self.move()
def __init__(self, spots):
self.giraffe_spots = spots
def left_foot_forward(self):
print('Left foot forward')
def right_foot_forward(self):
print('Right foot forward')
def left_foot_backward(self):
print('Left foot back')
def right_foot_backward(self):
print('Right foot back')
def dance(self):
self.left_foot_forward()
self.left_foot_backward()
self.right_foot_forward()
self.right_foot_backward()
self.left_foot_backward()
self.right_foot_backward()
self.right_foot_forward()
self.left_foot_forward()
reginald = Giraffes(200)
harold = Giraffes(15)