If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Challenge: Rock, paper, scissors

Instructions

Step 1

Play the computer's turn

Jesse outlined a rock, paper, scissors game, where a user competes against a computer player over multiple rounds. They laid out the game logic in the main.py file, but they left some function definitions in the round.py file to fill in later.

Each round, players pick either rock, paper, or scissors, and then compare their choices to determine the winner. Right now, the computer always picks scissors!

  • Fill in the make_computer_choice() function body to randomly choose between rock, paper, and scissors. Each choice should be equally likely.

Recall that you can use the random.randint() function to generate a random number. Make sure to import the random module at the top of round.py.

Code editor

Code files

Output