Course: Intro to computer science - Python > Unit 4
Lesson 3: Code organizationChallenge: 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
.