Advertisement
Guest User

odds and evens with a player name

a guest
Nov 12th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import random
  2.  
  3. player_name = input("What is your name? ")
  4.  
  5. player = input("Do you pick odd or even? ")
  6.  
  7. if player == "odd" or player == "Odd":
  8. print("Ok, you have chosen odds!")
  9.  
  10. if player == "even" or player == "Even":
  11. print("Ok, you have chosen evens!")
  12.  
  13. throw = int(input("How many fingers do you throw (1-5)?: "))
  14.  
  15. comp = random.randint(1, 5)
  16. print("The computer threw", comp,".")
  17.  
  18. total = comp + throw
  19. print("The total is", total)
  20.  
  21. if player == "even" or player == "Even":
  22. if total % 2 == 0:
  23. print("Congrats,",player_name,"won!")
  24. else:
  25. print("Sorry,",player_name,"lost.")
  26.  
  27. if player == "odd" or player == "Odd":
  28. if total % 2 == 0:
  29. print("Sorry,",player_name,"lost.")
  30. else:
  31. print("Congrats,",player_name,"won!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement