Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import random
  2. a=['a','an','the']
  3. s=['cat','dog','woman']
  4. g=['sang','ran','jumped']
  5. n=['lowly','quietly', 'well', 'badly']
  6.  
  7. l=0
  8. h=10
  9. count=5
  10.  
  11. while count!=type(int):
  12. try:
  13. count=input("Enter count string (0 to 10): ")
  14. if count=='':
  15. count=5
  16. count=int(count)
  17. if count<l or count>h:
  18. print("Enter int type and 0 to 10")
  19. continue
  20. except ValueError:
  21. print("Enter int type and 0 to 10")
  22. continue
  23. else:
  24. for i in range(1,int(count)+1):
  25. if random.randint(1,2)==1:
  26. print(random.choice(a),random.choice(s),random.choice(g),random.choice(n))
  27. else:
  28. print(random.choice(a),random.choice(s),random.choice(g))
  29. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement