Project: Rock, Paper, Scissors
Rock, Paper, Scissors is all about decisions, which makes it the perfect project for what you just learned. You will compare two choices and use if, elif, and else to announce the result.
What You'll Build
A program that takes the player's choice and the computer's choice, then prints who won.
Decision
Compare player vs computer
- If same choice
It's a tie
- If player's choice beats computer's
You win
- If otherwise
You lose
Step 1: The Two Choices
Store both choices in variables. We set them directly so the outcome is predictable while you build; you will add randomness at the end.
Step 2: The Winning Rules
There are exactly three ways the player wins: rock beats scissors, paper beats rock, scissors beats paper. Everything else (that is not a tie) is a loss.
Build It Yourself
Put it together with if / elif / else. With player = 'rock' and computer = 'scissors', produce the exact two lines below.
Make It Random
Real games are unpredictable. random.choice picks a random item from a list, so the computer plays a different move each run. Run this a few times:
Challenge Ideas
- Also pick the player's move at random and see who wins
- Keep a running score across several rounds (you will have loops soon)
- Add "lizard" and "spock" for the expanded version of the game
Key Takeaways
- Games are just decisions, which
if / elif / elsehandles perfectly - Check the tie first, then the win cases, then let
elsecover the rest random.choice(list)picks a random item, making the game replayable- Grouping conditions with
orkeeps the winning rules in one place

