1) What do I need to do?
π― Your mission: Build Rock, Paper, Scissors
Use everything you know: input, random.choice, if / elif / else, and and / or.
Print the player's choice, the computer's choice, and who won (or a tie).
2) What do I need to know?
Plan the battle
Rules: rock beats scissors, scissors beats paper, paper beats rock.
The plan:
1. Ask the player for their choice (use .lower())
2. The computer picks with random.choice()
3. Print both choices
4. If they're the same β tie. Otherwise check the 3 ways the player can win with and / or. Anything else β computer wins.
Bonus: wrap it in a loop for best of 3, keeping score!
π§° Your toolkit for this mission
Everything you need to know to finish this lesson on your own:
Player & computer choices
One from input(), one from random.choice.
How to write it: Import random first.
import random
player = input("rock, paper or scissors? ")
computer = random.choice(["rock", "paper", "scissors"])Draw
Same choice = nobody wins.
How to write it: Check player == computer first.
if player == computer:
print("Draw!")Win rules with and / or
Combine checks for each way to win.
How to write it: Each winning pair joined by or, each pair uses and.
elif (player == "rock" and computer == "scissors") or (player == "paper" and computer == "rock") or (player == "scissors" and computer == "paper"):
print("You win!")
else:
print("Computer wins!")Think about it
Look at this code. What happens next, and why? Say it in your own words.
if player == computer:
print("Tie!")Watch & explore βΆ
Power-up: Plan the battle
See it happen
1 / 3moves = ["rock", "paper", "scissors"]
Rock beats scissors. Scissors beats paper. Paper beats rock.
3) Run the code & terminal output
Press βΆ RUN and your program's messages appear here!


Captain Py
Our next adventure is yours to create.
