#This program plays rock, paper, scissors between 2 players
print("Let's play Rock, Paper, Scissors.")
print(" ")
player1 = input("Player 1, Enter your choice: ")
player2 = input("Player 2, Enter your choice: ")
# use if/else statements with nested structures to play
# rock < paper and rock > scissors
# paper < scissors and paper > rock
# scissors < rock and scissors > paper
while True:
if (player1.casefold() == "r" and player2.casefold() == "p"):
print("Rock v. Paper")
print("Player 2 wins")
elif (player1.casefold() == "p" and player2.casefold() == "r"):
print("Rock v. Paper")
print("Player 1 wins")
elif (player1.casefold() == "p" and player2.casefold() == "p" or player1.casefold() == "r" and player2.casefold() == "r"):
print("It's a TIE")
else:
print("[ERROR: m not a valid move.]")
#How to implement a while loop to iterate the game as long as players say yes to playing again
print(" ")
playAgain = input("again?\n")
if (playAgain.casefold() != "y"):
print("Nice game!")
break
I am still working on it so right now it's only rock and paper, but I'm not too sure why the while loop won't break. It actually never gets around to asking for user input as to whether they would like to play again.