Help me to fix this!

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!"  
      return "Paper covers rock! You loss!"
  elif player == "paper": 
    if computer == "rock":
      return "Paper covers rock! You win!"  
      return "Scissors cut the paper! You loss!"    
  elif player == "Scissors": 
    if computer == "Papers":
      return "Scissors cut the paper! You win!"  
      return "Rock smashes scissors! You loss!" 

choices = get_choices()
result = check_win(choices["player"], choices["computer"])

**This is output**

Enter a choice (rock, paper, sissors):paper
Traceback (most recent call last):
  File "", line 31, in <module>
    result = check_win(choices["player"], choices["computer"])
KeyError: 'player'

Welcome to the forum!

We need more info to help you.

What purpose does this code have?

1 Like

I watch free code camp video from you tube.
he teach first rock, paper, scissors game using python.
i follow his instructions and code then i run it, it shows error i did’nt know how to fix it.

Ok, couple more things: need link to the video, timecode

And what is the error exactly

1 Like

this is video link - youtube video

And This is the error

Traceback (most recent call last):
File “”, line 31, in
result = check_win(choices[“player”], choices[“computer”])
KeyError: ‘player’

you are using this dictionary, you have keys:

But in line 31 you are referring to something like

these keys don’t exist, so that’s a key error

I am not sure what’s the reason for that mistake. If this is about typos, well double check all the code for typos.

If it’s about understanding how dictionary work, consider more research.

1 Like

Thanks you so much. It was fix Love you freecodecamp :kissing_heart: :heart_eyes: :heart_eyes: