This is a Rock Paper Scissor Game. While running the program, I want it to end only while right input is entered, if not, it will loop until the right input is given. When running the program and entering a wrong input, the loop begins, but it is not ending by entering a right input again.
This is my code:
from getpass import getpass as input
print('''
EPIC ROCK PAPER SCISSORS ✂️ BATTLE ⚔️!
++++++++++++++++++++++++++++++++++++++++++++++
''')
player1 = input("""
Player 1 Please Enter Your Move
R =
P =
S = ✂️
""")
player2 = input("""
Player 2 Please Enter Your Move
R =
P =
S = ✂️
""")
if player1 == "R" and player2 == "S":
print("Player 1 Won")
elif player1 == "R" and player2 == "P":
print("Player 2 Won")
elif player1 == "R" and player2 == "R":
print("It is a Tie ")
elif player1 == "P" and player2 == "R":
print("Player 1 Won")
elif player1 == "P" and player2 == "S":
print("Player 2 Won")
elif player1 == "P" and player2 == "P":
print("It is a Tie ")
elif player1 == "S" and player2 == "S":
print("It is a Tie ")
elif player1 == "S" and player2 == "P":
print("Player 1 Won")
elif player1 == "S" and player2 == "R":
print("Player 2 Won")
else:
print("Wrong Move, Please Try Again")
while player1 == "P" or player1 != "S" or player1 != "R" or player2 != "P" or player2 != "S" or player2 != "R":
print('''
EPIC ROCK PAPER SCISSIORS ✂️ BATTEL ⚔️!
++++++++++++++++++++++++++++++++++++++++++++++
''')
player1 = input("""
Player 1 Please Enter Your Move
R =
P =
S = ✂️
""")
player2 = input("""
Player 2 Please Enter Your Move
R =
P =
S = ✂️
""")
if player1 == "R" and player2 == "S":
print("Player 1 Won")
elif player1 == "R" and player2 == "P":
print("Player 2 Won")
elif player1 == "R" and player2 == "R":
print("It is a Tie ")
elif player1 == "P" and player2 == "R":
print("Player 1 Won")
elif player1 == "P" and player2 == "S":
print("Player 2 Won")
elif player1 == "P" and player2 == "P":
print("It is a Tie ")
elif player1 == "S" and player2 == "S":
print("It is a Tie ")
elif player1 == "S" and player2 == "P":
print("Player 1 Won")
elif player1 == "S" and player2 == "R":
print("Player 2 Won")
print('''
Thanks for Playing
EPIC ROCK PAPER SCISSIORS ✂️ BATTLE ⚔️!
++++++++++++++++++++++++++++++++++++++++++++++
''')