import random
tries = 0
while tries <= 2:
user_input = input("Enter your Symbol => ")
possible_actions = ["Rock", "Paper", "Scissors"]
computer_action = random.choice(possible_actions)
score = 0
print(f"Computer Chose {computer_action}")
if user_input.lower() == "rock" and computer_action == "Scissors":
print("You Won! ")
tries += 1
print(f"You have {3-tries} tries left")
score += 1
if user_input.lower() == "scissors" and computer_action == "Rock":
print("You Lost!")
tries += 1
print(f"You have {3-tries} tries left")
if user_input.lower() == "paper" and computer_action == "Rock":
print("You Won!")
tries += 1
print(f"You have {3-tries} tries left")
score += 1
if user_input.lower() == "rock" and computer_action == "Paper":
print("You Lost!")
tries += 1
print(f"You have {3-tries} tries left")
if user_input.lower() == "scissors" and computer_action == "Paper":
print("You Won!")
tries += 1
print(f"You have {3-tries} tries left")
score += 1
if user_input.lower() == "paper" and computer_action == "Scissors":
print("You Lost!")
tries += 1
print(f"You have {3-tries} tries left")
if tries == 3:
print(f"You lost the competition as you had {tries} tries left")
if score == 3 and tries == 3:
print("You Won the competition")
This is a rock paper scissor game made using Python. Is there any way to make this code cleaner and prettier to look at? I tried to shorten it as much as possible. I also need to make it invulnerable to user errors like if the user inputs the wrong spelling.