-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw3.py
63 lines (47 loc) · 1.48 KB
/
hw3.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###FILE FOR HW 3
###PARTNER = VIVIAN
""" <s>
<np> <vp>
<dp><adjp><n> | <pn> <tv><np> | <iv>
2 2
2 2 8
<dp> <adjp> <n>
"the" | "a" <adj> | <adj><adjp> "dog" | "cat" | "man" | "university" | "father" | "mother" | "child" | "television"
6 7
<pn> <adj>
"John" | "Jane" | "Sally" | "Spot" | "Fred" | "Elmo" "big" | "fat" | "green" | "wonderful" | "faulty" | "subliminal" | "pretentious"
4 4
<tv> <iv>
"hit" | "honored" | "kissed" | "helped" "died" | "collased" | "laughed" | "wept"
"""
from random import randint
def s():
return np().capitalize() + " " + vp() + "."
def np():
if(randint(0,1)):
return pn()
else:
return dp() + " " + adjp() + " " + n()
def vp():
if(randint(0,1)):
return tv() + " " + np()
else:
return iv()
def dp():
return ["the","a"][randint(0,1)]
def adjp():
if(randint(0,1)):
return adj() + " " + adjp()
else:
return adj()
def adj():
return ["big" , "fat" , "green" , "wonderful" , "faulty" , "subliminal" , "pretentious"][randint(0,6)]
def n():
return ["dog", "cat", "man", "university", "father", "mother", "child", "television"][randint(0,7)]
def pn():
return ["John", "Jane", "Sally", "Spot", "Fred", "Elmo"][randint(0,5)]
def tv():
return ["hit", "honored", "kissed", "helped"][randint(0,3)]
def iv():
return ["died", "collased", "laughed", "wept"][randint(0,3)]
print s()