Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import random
  2. valid_input = "yes"
  3. play_again = "yes"
  4. while play_again != "no":
  5. while valid_input == "no":
  6. player_1 = input("Enter Rock, Paper or Scissors: ")
  7. options = ["rock", "paper", "scissors"]
  8. if player_1.lower() not in options:
  9. print("Please select a valid option")
  10. valid_input = "no"
  11.  
  12. player_2 = random.choice(["Rock", "Paper", "Scissors"])
  13. print("Player Two chose {}".format(player_2))
  14. if player_1.lower() == "rock" and player_2.lower() == "rock" or player_1.lower() == "paper" and player_2.lower() == "paper" or player_1.lower() == "scissors" and player_2.lower() == "scissors":
  15. print("Player One chose {}. Player Two also chose {}. This round is tied!".format(player_1, player_2))
  16. elif player_1.lower() == "rock" and player_2.lower() == "scissors" or player_1.lower() == "scissors" and player_2.lower() == "paper" or player_1.lower() == "paper" and player_2.lower() == "rock":
  17. print("{} beats {}. Player One wins!".format(player_1, player_2))
  18. elif player_2.lower() == "rock" and player_1.lower() == "scissors" or player_2.lower() == "scissors" and player_1.lower() == "paper" or player_2.lower() == "paper" and player_1.lower() == "rock":
  19. print("{} beats {}. Player Two wins!".format(player_2, player_1))
  20. play_again = input('Would you like to play another round? (yes/no):')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement