Computer Project
Gaming Python
Aryan. M
Adviath.A
11
ST.THOMAS ENGLISH MEDIUM SCHOOL, MYSURU
(Affiliated to CBSE, New Delhi, Affiliation No. 830085, School Code-45067
DEPARTMENT OF COMPUTER SCIENCE
CERTIFICATE
This is to certify that the project titled Python Code is a bonafide work carried out by Aryan.M and
Adviath.A of Standard XI of St. Thomas English Medium School, Mysuru, submitted in partial fulfilment
of the requirements for the AISSCE certificate from C.B.S.E under our guidance during the year 2023-2024.
Principal Teacher–In–Charge
Submitted for the AISSCE Examination held in the year 2023-2024 at St.Thomas English Medium
School, Mysuru
Internal Examiner External Examiner
Date: Date:
ACKNOWLEDGEMENT
First I take this opportunity to thank the Almighty God, who really enabled me to do this
project successfully. I would also like to express my gratitude to all those who have guided me.
I acknowledge my heartfelt thanks to the Principal Mr. Lintomon T. A, and my teacher Mrs.
Seem for her valuable guidance and encouragement. I thank all my teachers and friends who
have helped me to complete this task successfully.
I bow down to my parents for their inspiration and prayers without which this project might
not have been a success
DECLARATION
I hereby declare that this project entitled Python Code is a bonafide record of the project
work done by me, during the course of my studies in the academic year 2023-2024.This
report has not been previously formed the basis for the award of any certificate,
diploma or other similar title to me by any other board or society.
Name: Aryan.M, Adviath.A
Place: St. Thomas School, Mysore
Date: 3-1-2024
INDEX
Sl.no Topics Pg.no
1 Introduction 1
2 Software and Hardware 2
Requirements
3 Code 3-7
4 Output 8-10
5 Bibliography 11
Introduction
This Python script implements a simple console-based Rock, Paper,
Scissors game.
Players can choose between three options: Rock, Paper, or Scissors, and
play against
the computer. The winner is determined based on the classic game rules:
Rock crushes Scissors, Scissors cuts Paper, and Paper covers Rock.
How to Play:
1. Enter your choice when prompted (rock, paper, or scissors).
2. The computer will randomly choose its move.
3. The winner is determined, and the result is displayed.
4. You can choose to play again or exit the game.
Features:
- User-friendly interface with clear prompts.
- Randomized computer moves for unpredictability.
- Simple yet engaging gameplay for quick entertainment.
Software and Hardware Requirements
Software specification:
Operating System:Windows 10
Platform:Python IDLE 3.11
Database:MySQL
Language:Python
Hardware specification:
Procceser:Dual core or above
Hard disk:40GB
RAM:1GB
Code for Rock Paper Scissor game
# import random module
import random
# print multiline instruction
# performstring concatenation of string
print('Winning rules of the game ROCK PAPER SCISSORS are :\n'
+ "Rock vs Paper -> Paper wins \n"
+ "Rock vs Scissors -> Rock wins \n"
+ "Paper vs Scissors -> Scissor wins \n")
while True:
print("Enter your choice \n 1 - Rock \n 2 - Paper \n 3 - Scissors \n")
# take the input from user
choice=int(input("Enter your choice :"))
# OR is the short-circuit operator
# if any one of the condition is true
# then it return True value
# looping until user enter invalid input
while choice > 3 or choice <1:
choice=int(input('Enter a valid choice please ☺'))
# initialize value of choice_name variable
# corresponding to the choice value
if choice == 1:
choice_name= 'Rock'
elif choice == 2:
choice_name= 'Paper'
else:
choice_name= 'Scissors'
# print user choice
print('User choice is \n',choice_name)
print('Now its Computers Turn.. .')
# Computer chooses randomly any number
# among 1 , 2 and 3. Using randint method
# of random module
comp_choice = random.randint(1,3)
# looping until comp_choice value
# is equal to the choice value
while comp_choice == choice:
comp_choice = random.randint(1,3)
# initialize value of comp_choice_name
# variable corresponding to the choice value
if comp_choice == 1:
comp_choice_name = 'rocK'
elif comp_choice == 2:
comp_choice_name = 'papeR'
else:
comp_choice_name = 'scissoR'
print("Computer choice is \n", comp_choice_name)
print(choice_name,'Vs',comp_choice_name)
# we need to check of a draw
if choice == comp_choice:
print('Its a Draw',end="")
result="DRAW"
# condition for winning
if (choice==1 and comp_choice==2):
print('paper wins =>',end="")
result='papeR'
elif (choice==2 and comp_choice==1):
print('paper wins =>',end="")
result='Paper'
if (choice==1 and comp_choice==3):
print('Rock wins =>\n',end= "")
result='Rock'
elif (choice==3 and comp_choice==1):
print('Rock wins =>\n',end= "")
result='rocK'
if (choice==2 and comp_choice==3):
print('Scissors wins =>',end="")
result='scissoR'
elif (choice==3 and comp_choice==2):
print('Scissors wins =>',end="")
result='Scissors'
# Printing either user or computer wins or draw
if result == 'DRAW':
print("<== Its a tie ==>")
if result == choice_name:
print("<== User wins ==>")
else:
print("<== Computer wins ==>")
print("Do you want to play again? (Y/N)")
# if user input n or N then condition is True
ans = input().lower
if ans =='n':
break
# after coming out of the while loop
# we print thanks for playing
print("thanks for playing")
Output
Winning rules of the game ROCK PAPER SCISSORS are :
Rock vs Paper -> Paper wins
Rock vs Scissors -> Rock wins
Paper vs Scissors -> Scissor wins
Enter your choice
1 - Rock
2 - Paper
3 - Scissors
Enter your choice
:2 User choice is
Paper
Now its Computers Turn....
Computer choice is
rocK
Paper Vs rocK
paper wins =><== User wins ==>
Do you want to play again? (Y/N)
Enter your choice
1 - Rock
2 - Paper
3 - Scissors
Enter your choice :1
User choice is
Rock
Now its Computers Turn....
Computer choice is
papeR
Rock Vs papeR
paper wins =><== Computer wins ==>
Do you want to play again? (Y/N)
Enter your choice
1 - Rock
2 - Paper
3 - Scissors
Enter your choice :3
User choice is
Scissors
Now its Computers Turn....
Computer choice is
rocK
Scissors Vs rocK
Rock wins =>
<== Computer wins ==>
Do you want to play again? (Y/N)
Biblilography
geeksforgeeks.org/
chat.openai.com