You will build a console-based Rock–Paper–Scissors game in Python. The computer will randomly generate rock, paper, or scissors. The match is Best 3 out of 5 (first to 3 wins) and your program must keep score.
Skills Variables • Input/Output • Random • If/Else • Loops • Validation
rock, paper, or scissors.rock, paper, or scissors each round.player_scorecomputer_scorequit to end early.Save as: RPS_lastname.py
SET choices to ["rock", "paper", "scissors"]
SET player_score = 0
SET computer_score = 0
SET round_number = 1
DISPLAY game title and instructions
WHILE player_score < 3 AND computer_score < 3:
DISPLAY round number and current score
GET player input
IF player input is "quit":
DISPLAY quitting message
END program
IF player input not in choices:
DISPLAY invalid input message
CONTINUE loop
computer_choice = RANDOM choice from choices
DISPLAY player choice and computer choice
IF player choice == computer choice:
DISPLAY tie message
ELSE IF player beats computer:
player_score = player_score + 1
DISPLAY player wins round
ELSE:
computer_score = computer_score + 1
DISPLAY computer wins round
round_number = round_number + 1
DISPLAY final score
IF player_score > computer_score:
DISPLAY player won match
ELSE:
DISPLAY computer won match
DISPLAY game over
Copy/paste into RPS_lastname.py.
This code includes comments, input validation, score tracking, and best 3 out of 5 match rules.
| Category | What I’m Looking For | Points |
|---|---|---|
| Program Runs | Code runs without crashing | 20 |
| Random Computer Choice | Uses random.choice() to select rock/paper/scissors |
10 |
| Input & Validation | Accepts input and handles invalid choices correctly | 15 |
| Correct Game Logic | Correctly decides win/lose/tie every round | 20 |
| Score Tracking | Correctly updates and displays score | 15 |
| Best 3 out of 5 | Match ends when someone reaches 3 wins | 10 |
| Code Quality | Good comments, readable variable names, neat formatting | 10 |
| Total | 100 |
r, p, s)