Difficulty: Lv ★ | Prerequisites: Basic Weeks 4-5 (Conditionals, Loops, random)
Goal
User vs Computer Rock-Paper-Scissors — best of 3, with a cumulative overall record
Differences from Basic Assignment
- Basic Week 4 = outputs the result once and ends
- Here = best of 3 + infinite loop + re-request for wrong input + cumulative overall record
Requirements
- Input:
Rock,Paper,Scissors(full word orr/p/s) - The computer uses
random.choice - Display the result every round (win/loss/draw, current score)
- The first to reach 2 wins takes the match
- After a match, ask "Play one more game?"
- Accumulate the overall match record (wins/losses)
Input/Output Example
[Round 1] Current Score (0 : 0)
Choose (Rock/Paper/Scissors or r/p/s): Scissors
Computer: Paper → User Wins!
[Round 2] Current Score (1 : 0)
Choose (Rock/Paper/Scissors or r/p/s): Rock
Computer: Rock → Draw
...
🏆 Match Winner: User (2:1)
One more game? (y/n): n
[Overall Record] User wins: 1, Computer wins: 0
Thanks for playing!
Challenge Task
- The computer learns user patterns (predict the next move from the last 3 inputs)
- Save the overall record to a file
Execution
python solution.py
Grading Checklist
- Re-request wrong input
- Best of 3 handled correctly
- Accumulate the overall match record
- Greet on exit