-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathawfulpoetry2.py
More file actions
31 lines (27 loc) · 958 Bytes
/
awfulpoetry2.py
File metadata and controls
31 lines (27 loc) · 958 Bytes
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
#!/usr/bin/env python3
import random
import sys
articles=['a','the']
nouns=['cat','dragon','pyton','gun','grind','Archangelsk']
verbs=['catch','throw','try','left','make','do']
adverbs=['well','highly','annoyingly','fully']
max=5
if len(sys.argv)>1:
try:
if int(sys.argv[1])>0 and int(sys.argv[1])< 11:
max=int(sys.argv[1])
except ValueError as err:
print(err)
else:
print('Invalid argument. Argument must be 0<x<11.')
for x in range(max):
choice=random.randint(0,1)
if choice==0:
print(articles[random.randint(0,len(articles)-1)],
' ',nouns[random.randint(0,len(nouns)-1)],
' ',verbs[random.randint(0,len(verbs)-1)],
' ',adverbs[random.randint(0,len(adverbs)-1)])
else:
print(articles[random.randint(0,len(articles)-1)],
' ',nouns[random.randint(0,len(nouns)-1)],
' ',verbs[random.randint(0,len(verbs)-1)],)