Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- a=['a','an','the']
- s=['cat','dog','woman']
- g=['sang','ran','jumped']
- n=['lowly','quietly', 'well', 'badly']
- l=0
- h=10
- count=5
- while count!=type(int):
- try:
- count=input("Enter count string (0 to 10): ")
- if count=='':
- count=5
- count=int(count)
- if count<l or count>h:
- print("Enter int type and 0 to 10")
- continue
- except ValueError:
- print("Enter int type and 0 to 10")
- continue
- else:
- for i in range(1,int(count)+1):
- if random.randint(1,2)==1:
- print(random.choice(a),random.choice(s),random.choice(g),random.choice(n))
- else:
- print(random.choice(a),random.choice(s),random.choice(g))
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement