So i wrote my first Rock, Paper, Scissors in Python and it nearly works. The problem is that it sometimes reads "scissors" as an invalid input, which seems to me completely randomly and i dont know what the problem is. Hoping for an easy fix for it. Here's the code:
import time
import random
choice_list = ["Rock", "Paper", "Scissors"]
def game():
won = False
lost = False
while not won and not lost:
user = input("Enter your choice from Rock, Paper or Scissors: ")
user_i = user.lower()
com_1 = random.choice(choice_list)
com_choice = com_1.lower()
if com_choice == user_i:
print("Draw, try again!")
elif com_choice == "rock" and user_i == "paper":
won = True
elif com_choice == "rock" and user_i == "scissors":
lost = True
elif com_choice == "paper" and user_i == "rock":
lost = True
elif com_choice == "paper" and user_i == "scissors":
won = True
elif com_choice == "scissors" and user_i == "rock":
won = True
elif com_choice == "scissors" and user_i == "paper":
lost = True
elif user != "scissors" or "paper" or "rock":
print("Invalid choice, try again...")
if won:
print("Congrats you won, the PC chose " + com_1 + "!")
won = False
if lost:
print("You lost, the PC chose " + com_1 + "!")
lost = False
play_again = "yes"
while play_again.lower() == "yes":
game()
play_again = input("Would u like to play again? ")
if play_again.lower() != "yes":
print("Goodbye!")
time.sleep(3)