File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import random
9
9
10
+
10
11
class PetShop :
11
12
12
13
"""A pet shop"""
@@ -64,6 +65,7 @@ def get_pet(self):
64
65
def get_food (self ):
65
66
return "cat food"
66
67
68
+
67
69
# Create the proper family
68
70
def get_factory ():
69
71
"""Let's be dynamic!"""
Original file line number Diff line number Diff line change 3
3
4
4
"""http://ginstrom.com/scribbles/2008/11/06/generic-adapter-class-in-python/"""
5
5
6
- import os
7
6
8
7
class Dog (object ):
9
8
def __init__ (self ):
10
9
self .name = "Dog"
10
+
11
11
def bark (self ):
12
12
return "woof!"
13
13
14
+
14
15
class Cat (object ):
15
16
def __init__ (self ):
16
17
self .name = "Cat"
18
+
17
19
def meow (self ):
18
20
return "meow!"
19
21
22
+
20
23
class Human (object ):
21
24
def __init__ (self ):
22
25
self .name = "Human"
26
+
23
27
def speak (self ):
24
28
return "'hello'"
25
29
26
30
27
31
class Car (object ):
28
32
def __init__ (self ):
29
33
self .name = "Car"
34
+
30
35
def make_noise (self , octane_level ):
31
36
return "vroom{0}" .format ("!" * octane_level )
32
37
You can’t perform that action at this time.
0 commit comments