๐น Introduction

The Rock, Paper, Scissors Game is a classic hand game that you can easily build in Python.
- The player chooses Rock, Paper, or Scissors.
- The computer randomly chooses one too.
- The winner is decided based on the game rules.
๐ Rules:
- Rock beats Scissors
- Scissors beats Paper
- Paper beats Rock
๐น Code Example
import random
print("๐ฒ Welcome to Rock, Paper, Scissors Game!")
choices = ["rock", "paper", "scissors"]
while True:
# Player choice
player = input("๐ Enter rock, paper, or scissors (or 'q' to quit): ").lower()
if player == "q":
print("๐ Thanks for playing! Goodbye.")
break
if player not in choices:
print("โ ๏ธ Invalid choice. Please try again.")
continue
# Computer choice
computer = random.choice(choices)
print(f"๐ป Computer chose: {computer}")
# Decide winner
if player == computer:
print("๐ค It's a tie!")
elif (player == "rock" and computer == "scissors") or \
(player == "scissors" and computer == "paper") or \
(player == "paper" and computer == "rock"):
print("๐ You win!")
else:
print("๐ข You lose!")
๐น Example Run
๐ฒ Welcome to Rock, Paper, Scissors Game!
๐ Enter rock, paper, or scissors (or 'q' to quit): rock
๐ป Computer chose: scissors
๐ You win!
๐ Enter rock, paper, or scissors (or 'q' to quit): paper
๐ป Computer chose: scissors
๐ข You lose!
๐ Enter rock, paper, or scissors (or 'q' to quit): q
๐ Thanks for playing! Goodbye.
๐น Concepts Learned
- random.choice() โ lets the computer pick a random option.
- while loop โ allows continuous play until the player quits.
- if/elif/else โ determines the winner.
- string methods (like
.lower()) to handle user input better.
๐น Summary
- Built a Rock, Paper, Scissors game in Python.
- Practiced loops, random choices, and conditionals.
- Added option to quit (
q).