I have to do a project on a game of rock, paper, and scissors, and the code I have so far is a complete code for the game, but my professor does not like it since it is too redundant. Is there anyway to shorten it or make it more simple?
import random
while True:
bot = random.choice(["Rock", "Paper", "Scissors"]).lower()
user_choice = input("Choose between Rock, Paper, and Scissors or -1 to exit: \n ").lower()
if user_choice == bot:
print("We tied! I chose", bot," and you chose", user_choice)
elif user_choice == "rock":
if bot == "paper":
print("You lose! I chose", bot," and you chose", user_choice , ", Paper beats rock!")
elif bot == "scissors":
print("You win! I chose", bot," and you chose", user_choice , ", Rock beat scissors!")
elif user_choice == "paper":
if bot == "rock":
print("You win! I chose",bot," and you chose", user_choice , ", Paper beats rock!")
elif bot == "scissors:":
print("You lose! I chose", bot," and you chose", user_choice , ", Scissors beats paper")
elif user_choice == "scissors":
if bot == "paper":
print("You win! I chose", bot," and you chose",user_choice, ", Scissors beats paper")
elif bot == "rock":
print("You Lose! I chose", bot," and you chose", user_choice , ", Rock beats scissors")
else:
print("Invalid Entry, you typed:", user_choice, ", Please try again: ")
if user_choice == '-1':
print("You selected -1 to exit, Goodbye!")
exit()