0% found this document useful (0 votes)
2 views

Python Programming

The document is a micro project report on creating a Rock Paper Scissors game using Python, submitted by Sahil Pritam Shaha at Navsahyadri Education Society's Group of Institutions. It outlines the features and advantages of Python, the algorithm for the game, and includes the program code along with its explanation. The project was completed under the guidance of Prof. Bandal and adheres to the Maharashtra State Board of Technical Education curriculum.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Programming

The document is a micro project report on creating a Rock Paper Scissors game using Python, submitted by Sahil Pritam Shaha at Navsahyadri Education Society's Group of Institutions. It outlines the features and advantages of Python, the algorithm for the game, and includes the program code along with its explanation. The project was completed under the guidance of Prof. Bandal and adheres to the Maharashtra State Board of Technical Education curriculum.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Navsahyadri Education Society's

Group of Institutions
(Polytechnic)

Sr.No.69,70,71, Naigaon [Nasarapur],


Tal- Bhor, Pune-412213.
website: https://www.navsahyadri.edu.in/

Topic Name

Rock Paper Scissor Game Using Python

MICRO PROJECT REPORT


Submitted in Summer 25

Sr. Roll No: Enrollment Seat No


Name of the student
No No

1 24 SAHIL PRITAM SHAHA 2215150220

Under the Guidance of


Prof. Bandal. S. S
At
Navsahyadri Education Society's
Group of Institutions (Polytechnic)
Sr.No.69,70,71, Naigaon [Nasarapur],
Tal- Bhor, Pune-412213.
website: https://www.navsahyadri.edu.in/
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI

Certificate
This is to certify that Mr. Sahil Pritam Shaha Roll No: 24
of Sixth Semester of Diploma Programming in Engineering
& Technology at 1515–NIT Polytechnic Pune, has completed
the Micro Project satisfactorily in Subject Python Programming
[22616] in the academic year 2024-2025 as per the MSBTE
prescribed curriculum of I Scheme.

Place: Pune Enrollment No: 2215150220

Date: / /2024 Exam. Seat No:

Project Guide Head of the Department Principal

Seal Of
Institue
Index..

Sr. No Title Page No.

1 Introduction

2 Objectives (Cos)

3 Main Body / Content

4 Conclusion / Learning Outcomes


Introduction To The Topic
Rock Paper Scissor Game

 What Is Python Language ?


Python is a high-level, interpreted programming language known for
its simplicity and readability. It was created by Guido van Rossum
and first released in 1991. Python emphasizes code readability and
uses indentation to define blocks of code, making it easy to learn and
use.

Key Features of Python:

1. Easy to Learn and Use: Python has a simple syntax that is


similar to English, making it ideal for beginners.

2. Interpreted Language: Python executes code line by line,


allowing for easier debugging and testing.

3. Dynamically Typed: You don’t need to declare variable types


explicitly. For example, you can assign x = 5 without specifying
that x is an integer.

4. Versatile: Python is used for a wide range of applications,


including:

o Web development (Django, Flask)

o Data analysis and visualization (Pandas, Matplotlib,


Seaborn)

o Machine learning and AI (TensorFlow, PyTorch, Scikit-


learn)

o Scripting and automation

o Game development
5. Extensive Libraries and Frameworks: Python has a rich
ecosystem of libraries and frameworks that simplify
development.

6. Cross-Platform: Python code can run on different operating


systems like Windows, macOS, and Linux without modification.

7. Community Support: Python has a large and active


community, making it easy to find help and resources.
 Features of Python:

1. Simple and Readable Syntax:


Python's syntax is straightforward and similar to
English, making it easy to write and understand
code.

2. Interpreted Language:
Python code is executed line-by-line, which allows
for quick testing and debugging.

3. Dynamically Typed:
You don’t need to specify variable types explicitly;
Python determines them at runtime.

4. Extensive Standard Library:


Python comes with a rich set of built-in libraries for
tasks like file I/O, regular expressions, networking,
and more.

5. Cross-Platform:
Python is compatible with major operating systems
like Windows, macOS, and Linux, ensuring
portability.
6. Object-Oriented and Procedural:
Python supports multiple programming paradigms,
including object-oriented, procedural, and
functional programming.

7. Garbage Collection:
Python has automatic memory management,
freeing unused memory to optimize performance.

8. Open Source:
Python is freely available for use and modification,
backed by a large developer community.

9. Third-Party Libraries:
Python’s ecosystem includes powerful third-party
libraries like NumPy, Pandas, TensorFlow, and
Flask, enabling development across various
domains.
 Advantages of Python:

1. Ease of Learning and Use:


Its simplicity makes Python an excellent choice
for beginners and professionals alike.

2. Versatility:
Python is used in diverse fields, including web
development, data science, artificial intelligence,
machine learning, automation, and game
development.

3. Rapid Development:
Python’s concise syntax reduces development time
and improves productivity.

4. Community Support:
Python has a vast and active community, which
provides abundant resources, tutorials, and third-
party tools.

5. Integration Capabilities:
Python can easily integrate with other languages
and technologies like C, C++, Java, and .NET.

6. Scalability:
Python can handle large-scale applications,
making it suitable for enterprise-level software.
7. Rich Libraries and Frameworks:
Libraries like Django and Flask for web
development or Scikit-learn and TensorFlow for
AI and machine learning save time and effort.

8. Portability:
Python code written on one platform can run on
another without modification, provided necessary
dependencies are present.

9. Automation:
Python simplifies scripting and automating
repetitive tasks, making it popular among system
administrators.

10. Cost-Effective:
Being open-source and free, Python reduces
software development costs.
Algorithm Steps :
1. Start the program.
2. Display a welcome message: "Welcome to Stone, Paper,
Scissors Game!"
3. Set rounds = 1 to start the first round.
4. Loop (until the user decides to exit):
5. Display the current round number.
6. Prompt Player 1 to choose 1 for Stone, 2 for Paper, or 3 for
Scissors.
7. Prompt Player 2 to choose 1 for Stone, 2 for Paper, or 3 for
Scissors.
8. Validate the inputs:
a. If either player inputs a number other than 1, 2, or 3,
display an error message and continue to the next iteration.
9. Convert the numeric choice to the corresponding string
("Stone", "Paper", or "Scissor") using the get_choice() function.
10. Display the choices of both players (e.g., "Player 1 chose:
Stone").
11. Determine the winner using the determine_winner()
function:
a. If both players choose the same option, print "Match
Draw!".
b. If Player 1 wins based on the rules, print "Player 1 Wins!".
c. If Player 2 wins based on the rules, print "Player 2 Wins!".
12. Ask if both players want to play another round.
a. If the answer is "no", exit the loop and print "Thanks for
playing!".
b. If the answer is "yes", increment the round and continue to
the next round.
13. End the program.
Program :
import random

def get_choice(choice):
if choice == 1:
return "Stone"
elif choice == 2:
return "Paper"
elif choice == 3:
return "Scissor"

def determine_winner(player1, player2):


if player1 == player2:
return "Match Draw!"
elif (player1 == 1 and player2 == 3) or (player1 == 2 and
player2 == 1) or (player1 == 3 and player2 == 2):
return "Player 1 Wins!"
else:
return "Player 2 Wins!"

print("Welcome to Stone, Paper, Scissors Game!")


rounds = 1

while True:
print(f"\nRound {rounds}")

try:
player1_choice = int(input("Player 1, select: 1 for
Stone, 2 for Paper, 3 for Scissors: "))
player2_choice = int(input("Player 2, select: 1 for
Stone, 2 for Paper, 3 for Scissors: "))
# Validate input
if player1_choice not in [1, 2, 3] or player2_choice not
in [1, 2, 3]:
print("\nInvalid input! Please choose 1, 2, or 3.")
continue

player1 = get_choice(player1_choice)
player2 = get_choice(player2_choice)

print(f"\nPlayer 1 chose: {player1}")


print(f"Player 2 chose: {player2}\n")

result = determine_winner(player1_choice,
player2_choice)
print(result)

# Ask to continue playing or exit


play_again = input("\nDo you want to play another
round? (yes/no): ").lower()
if play_again != 'yes':
print("\nThanks for playing!")
break

rounds += 1
except ValueError:
print("\nInvalid input! Please enter a number.")
Program Output :
Explanation Of Program :

1. Imports:
o The random module is imported, but not used in this

version.

2. get_choice(choice):
o Converts a player's numeric input (1, 2, or 3) to a

string ("Stone", "Paper", or "Scissor").

3. determine_winner(player1, player2):
o Decides the winner based on the rules of the game:

 If both players choose the same option, it's a

draw.
 If Player 1 beats Player 2's choice, Player 1

wins.
 Otherwise, Player 2 wins.

4. Main Game Loop:


o Prompts Player 1 and Player 2 to select Stone,

Paper, or Scissors.
o Validates input to ensure it's 1, 2, or 3.

o Displays the choices of both players and announces

the winner.
o Asks if the players want to play another round.

5. Exit:
o The game continues until the player chooses not to

play again.

This program provides an interactive way to play Stone,


Paper, Scissors for multiple rounds.
Conclusion :

We Successfully Created
Stone Papper Scissor Game

Created By :
Sahil Pritam Shaha
TYCO - A
Roll No - 24

You might also like