I have created a game of rock, paper scissors, where the user plays vs the computer. Right now it is stuck in an infinite loop and because I'm new to python I don't know how to end the loop. I've added an example below of how I want it to go. Any help would be appreciated! :)
import random
print("Welcome to the game of rock, paper, scissors!")
newLi = ["Rock", "Paper", "Scissors"]
numRandom = newLi[random.randint(0, 3)]
user = False
while not user:
user = input("Rock, Paper, Scissors? \nAnswer: ")
if user == numRandom:
print("It's a tie! Please try again.")
elif user == "Rock" or user == "rock":
if numRandom == "Paper":
print("Aw! You lost. Try again!", numRandom, "covers", user)
else :
print("Good job! You're the winner!", user, "smashes", numRandom)
elif user == "Paper" or user == "paper":
if numRandom == "Scissors":
print("Aw! You lost. Try again!", numRandom, "cuts", user)
else :
print("Good job! You're the winner!", user, "covers", numRandom)
elif user == "Scissors" or user == "scissors":
if numRandom == "Rock":
print("Aw! You lost. Try again!", numRandom, "smashes", user)
else :
print("Good job! You're the winner!", user, "cuts", numRandom)
else:
print("Invalid answer! Try again.")
endGame = input("Would you like to keep playing? Y or N\nAnswer: ")
if endGame == "Y"
KEEP PLAYING
else:
STOP PLAYING