This is my code!
import random
def get_choices():
player_choice = input("Enter a choice (rock, paper, sissors):")
options = ["Rock", "Paper", "scissors"]
computer_choice = random.choice(options)
choices = {"Player:": player_choice, "Computer": computer_choice}
return choices
def check_win(player, computer):
print(f"You choose {player}, computer choose {computer}")
if player == computer:
return "It's a tie"
elif player == "rock":
if computer == "scissors":
return "Rock smashes scissors! You win!"
else:
return "Paper covers rock! You loss!"
elif player == "paper":
if computer == "rock":
return "Paper covers rock! You win!"
else:
return "Scissors cut the paper! You loss!"
elif player == "Scissors":
if computer == "Papers":
return "Scissors cut the paper! You win!"
else:
return "Rock smashes scissors! You loss!"
choices = get_choices()
result = check_win(choices["player"], choices["computer"])
print(result)
**This is output**
Enter a choice (rock, paper, sissors):paper
Traceback (most recent call last):
File "main.py", line 31, in <module>
result = check_win(choices["player"], choices["computer"])
KeyError: 'player'