Advertisement
Guest User

odds or evens

a guest
Nov 12th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import random
  2.  
  3. OddorEven = random.randint(1,2)
  4.  
  5. if OddorEven == 1:
  6. print("You are odds")
  7. if Oddoreven == 2:
  8. print("You are evens")
  9.  
  10. playerNum = int(input("How many fingers do you want to throw (1-5): "))
  11.  
  12. if playerNum <= 5 and playerNum >= 1:
  13. computerNum = random.randint(1, 5)
  14.  
  15. print("Computer throws", computerNum)
  16.  
  17. total = playerNum + computerNum
  18.  
  19. print("total figers are", total)
  20.  
  21. if Oddsoreven == 1:
  22. if total % 2 == 0:
  23. print("You lost.")
  24. else:
  25. print("You won!")
  26. if OddsorEven == 2:
  27. if total % 2 == 0:
  28. print("You won!")
  29. else:
  30. print("You lost.")
  31.  
  32. else:
  33. while playerNum >= 6 or playerNum <= 0:
  34. print("You can't do that")
  35. playerNum = int(input("How many fingers do you want to throw (1-5): "))
  36. if playerNum <= 5 and playerNum >= 1:
  37. computerNum = random.randint(1, 5)
  38.  
  39. print("Computer throws", computerNum)
  40.  
  41. total = playerNum + computerNum
  42.  
  43. print("total figers are", total)
  44.  
  45. if Oddsoreven == 1:
  46. if total % 2 == 0:
  47. print("You lost.")
  48. else:
  49. print("You won!")
  50. if OddsorEven == 2:
  51. if total % 2 == 0:
  52. print("You won!")
  53. else:
  54. print("You lost.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement