Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- valid_input = "yes"
- play_again = "yes"
- while play_again != "no":
- while valid_input == "no":
- player_1 = input("Enter Rock, Paper or Scissors: ")
- options = ["rock", "paper", "scissors"]
- if player_1.lower() not in options:
- print("Please select a valid option")
- valid_input = "no"
- player_2 = random.choice(["Rock", "Paper", "Scissors"])
- print("Player Two chose {}".format(player_2))
- 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":
- print("Player One chose {}. Player Two also chose {}. This round is tied!".format(player_1, player_2))
- 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":
- print("{} beats {}. Player One wins!".format(player_1, player_2))
- 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":
- print("{} beats {}. Player Two wins!".format(player_2, player_1))
- play_again = input('Would you like to play another round? (yes/no):')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement