pyp
pyp
Rock, Paper, Scissors is a simple and well-known hand game typically played between two
players. The players at the same time make one of three figures: Rock (fist), Paper (open hand),
or Scissors (fist with the two fingers extended). The winner of the game is decided by the
following rules:
Random Module: To allow the computer to select an option randomly. Conditionals: To contrast
the two options and to ascertain the outcome. This is a simple game that will help to reinforce
your Python programming skills, particularly in variable management, input and output, and if
statements.
1
OBJECTIVE
The primary objective of this Python program is to create an interactive game where a player
competes against the computer in the classic Rock, Paper, Scissors game. The program aims to:
1. Allow User Interaction: Prompt the player to input their choice of Rock, Paper,
or Scissors.
2. Random Computer Selection: Enable the computer to randomly select one of the
three options (Rock, Paper, or Scissors).
3. Determine the Winner: Compare the player's choice and the computer’s choice,
and determine the winner based on the following rules:
a. Rock beats Scissors.
b. Scissors beats Paper.
c. Paper beats Rock.
4. Display Results: Output the choices made by both the player and the computer
and announce the outcome of the game (win, loss, or tie).
5. Enhance Python Skills: Provide practice with essential Python concepts such
as variables, input/output, conditionals, and randomization.
2
Tools and Technologies Used in the Python Program
Technologies Involved:
Python Version: The game can be developed with any version of Python 3.x.
Operating System: The program can be run on any operating system (Windows,
macOS, Linux) with Python installed.
3
PROGRAM
import random
user_wins = 0 computer_wins = 0
"scissors"]
random_number =
random.randint(0, 2) # rock: 0,
paper: 1, scissors: 2
computer_pick = options[random_number]
print("Computer picked",
computer_pick + ".")
else:
print("You lost!")
computer_wins += 1
4
OUTPUT
5
CONCLUSION
The Rock, Paper, Scissors game in Python is a fun and simple project that helps reinforce key
programming concepts such as user input handling, conditionals, loops, and randomization. By
implementing this game, we have created an interactive and engaging experience where a player
can compete against the computer, while practicing fundamental skills like decision-making
logic and game flow control.
Allowed the player to make choices and interact with the computer.
Used random number generation to simulate the computer's decisions.
Implemented conditions to determine the outcome of each round.
Incorporated optional features such as score tracking and a game loop for
multiple rounds.
Additionally, there’s room to expand this project by adding advanced features like a
graphical user interface (GUI), difficulty levels, or multiplayer modes, which would further
enhance the game and provide more opportunities for learning.
Overall, this Python program serves as a great starting point for beginners, offering valuable
experience in problem-solving, code structure, and user interaction. It can be modified and
extended to create even more complex and interactive games, paving the way for future
programming projects.