I am making a simple rock paper scissors game. I am trying to make the user input again if his input isn't rock, paper and scissors. I tried using just else/if/elif but it didn't work. I then tried try and except but it still didn't work.
Here is the code:
Main.py
import random
def rps():
 while True:
     uw = 0 #user wins
     cw = 0 #computer wins
     option = ["rock", "paper", "scissors"] #option so the computer can choose from
     rcn = random.randint(0, 2) #random int variable
     cnp = option[rcn] #random computer option using random int variable
    
     ui = None
     print("Welcome to Rock Paper Scissors!") #start
     print("")
     pon = input("Would you like to play Yes/No? ")
     if pon.lower == "No":
        break #closing if doesnt want
     elif pon.lower() == "Yes":     
      continue
     ui = input("Select rock, paper or scissors: ")
    
     if ui == "rock" and cnp == "scissors":
      print("You won! Computer picked", cnp + ".")
      uw += 1
     elif ui == "rock" and cnp == "paper":
             print("You lost! Computer picked", cnp + ".")
             cw += 1
     elif ui == "rock" and cnp == "rock":
      print("Draw! Computer picked", cnp + ".")
     elif ui == "scissors" and cnp == "paper":
       print("You won! Computer picked", cnp + ".")
       uw += 1
     elif ui == "scissors" and cnp == "rock":
         print("You lost! Computer picked", cnp + ".")
         cw += 1
     elif ui == "scissors" and cnp == "scissors":
         print("Draw! Computer picked", cnp + ".")
     elif ui == "paper" and cnp == "rock":
         print("You won! Computer picked", cnp + ".")
         uw += 1
     elif ui == "paper" and cnp == "scissors":
         print("You lost! Computer picked", cnp + ".")
         cw += 1
    
     elif ui == "paper" and cnp == "paper":
          print("Draw! Computer picked", cnp + ".")
    
     else:
         print("Invalid input. Try again!")
         ui = input("Select rock, paper or scissors: ")
    # i also tried this one but still
    #else: 
      #   try:
     #         print("Invalid input. Try again!")
       #       ui = input("Select rock, paper or scissors: ")
      #   except ValueError:
        #       print("Invalid input. Try again!")
        #       ui = input("Select rock, paper or scissors: ")
         
    
     c = input("Would you like to play again Yes/No: ")
     if c == "No":
         print("")
         print("Your wins", uw)
         print("Computer wins", cw)
         b = input("Would you like to close the game Yes/No? ")
         if b.lower() == "Yes":
              break
         elif b.lower() == "No":
              continue
     elif c == "Yes":
           continue
rps()
If somebody could help me i would be thankful!
 
     
    