-
Notifications
You must be signed in to change notification settings - Fork 0
/
house.py
40 lines (36 loc) · 784 Bytes
/
house.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
actions = [
"lay in",
"ate",
"killed",
"worried",
"tossed",
"milked",
"kissed",
"married",
"woke",
"kept",
"belonged to",
"",
]
things = [
"house that Jack built.",
"malt",
"rat",
"cat",
"dog",
"cow with the crumpled horn",
"maiden all forlorn",
"man all tattered and torn",
"priest all shaven and shorn",
"rooster that crowed in the morn",
"farmer sowing his corn",
"horse and the hound and the horn",
]
def recite(start_verse, end_verse):
return [verse(n) for n in range(start_verse - 1, end_verse)]
def verse(n):
return ' '.join(
["This is the {}".format(things[n])] +
["that {} the {}".format(actions[i], things[i])
for i in range(n)][::-1]
)