well, I was writing my rock paper scissor code in python and everything was good until when I was trying so much to make it more sophisticated. Till line 28 everything is good and like a usual rock paper scissor game but after that, I wanted to say that we have only 2 right answers for the question "do you want to continue or not" and whenever the answer is yes return the whole game and repeat it (btw because of the return code I add a def and called it RPS) and if the answer of the user is no break it and say goodbye but when I run the code the only thing I receive in the terminal is a "click anything to continue". Please if you know the answer help me. :)
HERE IS MY CODE :
import random
def RPS():
while True:
user_action = input("Please enter rock, paper or scissor : ")
possible_actions = ["rock" , "paper" , "scissor"]
computer_action = random.choice(possible_actions)
if user_action == computer_action:
print(f"Your choice is same as your computer . . . It's a tie!!!")
elif user_action == "rock":
if computer_action == "scissor":
print(f"You Won!!! your choice was rock and the computer choice was scissor")
else:
print("Paper covers rock! You lose.")
elif user_action == "paper":
if computer_action == "rock":
print(f"You won!!! your choice was rock and the computer choice was rock")
else:
print("Scissors cuts paper! You lose.")
elif user_action == "scissor":
if computer_action == "paper":
print(f"You won!!! your choice was scissor and the computer choice was paper")
else:
print("Rock smashes scissor. You lose!!!")
play_again = input("Play again? (y/n): ")
possible_responses = {'y' , 'n'}
while possible_responses == play_again.lower():
if play_again.lower()=='y':
return(RPS)
else:
break
print(f"Alright. good bye")