A
Project Report On
“ROCK, PAPER, SCISSORS GAME USING PYTHON”
Submitted By:
Deokar Vedant (020)
Subject:
Programming with Python (22616)
Under Guidance Of:
Prof. [Link]
Department of Computer Technology
Sanjivani K. B. P. Polytechnic, Kopargaon.
Sanjivani K. B. P. Polytechnic, Kopargaon.
Certificate
Project entitled
“ROCK, PAPER, SCISSORS GAME USING PYTHON”
Submitted By:
Deokar Vedant (020)
Approved for Diploma in Computer Technology.
Under Guidance Of:
Prof. [Link]
Subject Teacher Head of Department
Prof. [Link] [Link]
pg. 2
ACKNOWNLEGMENT
First and the foremost I, express my deep sense of gratitude,sincere
thanks and deep sense of application to Project Guide Prof.M.V Khasne,
Department of Computer Technology, Sanjivani K.B.P. Polytechnic,
Kopargaon. Your availability at any time throughout the year, valuable
guidance, opinion, view, comment, critics, encouragement, and support
tremendously boosted this project work.
Lots of thanks to Head of Computer Technology Department, Prof.
G. N. Jorvekar for providing me the best support I ever had. I like to express
my sincere gratitude to Prof. A.R. Mirikar, Principal, Sanjivani K.B.P.
Polytechnic, Kopargaon for providing great platform to complete the
project within the scheduled time. I am also Thankful to all the faculty
members, Computer Technology Department, Sanjivani K.B.P.
Polytechnic, Kopargaon for giving comments for improvement of work,
encouragement and help during completion of the project.
Last but not the least; I should say thanks from our bottom of heart to
our family and friends for their never ending love, help, and support in so
many ways through all this time. Thank you so much.
Mast Deokar Vedant Rajendra(2000340359)
pg. 3
INDEX
1. Introduction
2. Overview
3. Source code
4. Output
5. Conclusion
pg. 4
Introduction
Video games have always been a fun part of our lives so let’s create a
basic version of Rock Paper Scissors game using Python. This is a fun
project with a lot of learning and after successfully completing this project
boredom would never surround us as we’re going to have our very own
[Link] paper scissors game is also known as stone paper scissors. It
is a hand game that is usually played between 2 people, each player can
randomly form any one of three from their hand.
A player who chooses rock will win by another player who chooses
scissors but loose by the player who chooses paper; a player with paper
will loose by the player with the [Link] both players choose the same
then the game is tied. Rock paper scissors game is mainly played among
kids.
pg. 5
Overview
The object of the rock-paper-scissor python project is to build a game for
a single player that plays with a computer, anywhere, and anytime. This
project is base on the rules that:
• rock blunts scissors so rock wins
• scissors cut the paper so scissors win
• paper cover rock so paper wins
This project is build using tkinter, random modules, and the basic concept
of python.
In this python project, players have to choose any one from rock, paper,
and scissors. Then click on the play button will show the result of the
game.
Project Structure
These are the step to build a rock-paper-scissors game using python:
• Import required libraries
• Initialize window
• Code for user choice
• Code for computer choice
• Define functions
• Define buttons
pg. 6
Source Code
#import library from
tkinter import *
import random
#initialize window root =
Tk()
[Link]('400x400')
[Link](0,0)
[Link]('DataFlair-Rock,Paper,Scissor') [Link](bg
='seashell3')
#heading
Label(root, text = 'Rock, Paper ,Scissor' , font='arial 20 bold', bg =
'seashell2').pack()
##user choice user_take
= StringVar()
Label(root, text = 'choose any one: rock, paper ,scissor' , font='arial 15
bold', bg = 'seashell2').place(x = 20,y=70)
Entry(root, font = 'arial 15', textvariable = user_take , bg =
'antiquewhite2').place(x=90 , y = 130)
pg. 7
#computer choice
comp_pick = [Link](1,3)
if comp_pick == 1: comp_pick
= 'rock' elif comp_pick ==2:
comp_pick = 'paper' else:
comp_pick = 'scissor'
##function to play
Result = StringVar() def
play():
user_pick = user_take.get() if user_pick ==
comp_pick: [Link]('tie,you both select same')
elif user_pick == 'rock' and comp_pick == 'paper':
[Link]('you loose,computer select paper') elif
user_pick == 'rock' and comp_pick == 'scissor':
[Link]('you win,computer select scissors') elif
user_pick == 'paper' and comp_pick == 'scissor':
[Link]('you loose,computer select scissors')
elif user_pick == 'paper' and comp_pick == 'rock':
pg. 8
[Link]('you win,computer select rock') elif
user_pick == 'scissors' and comp_pick == 'rock':
[Link]('you loose,computer select rock') elif
user_pick == 'scissors' and comp_pick == 'paper':
[Link]('you win ,computer select paper') else:
[Link]('invalid: choose any one -- rock, paper, scissor')
##fun to reset
def Reset():
[Link]("")
user_take.set("")
##fun to exit
def Exit():
[Link]()
### button
pg. 9
Entry(root, font = 'arial 10 bold', textvariable = Result, bg
='antiquewhite2',width = 50,).place(x=25, y = 250)
Button(root, font = 'arial 13 bold', text = 'PLAY' ,padx =5,bg ='seashell4'
,command = play).place(x=150,y=190)
Button(root, font = 'arial 13 bold', text = 'RESET' ,padx =5,bg ='seashell4'
,command = Reset).place(x=70,y=310)
Button(root, font = 'arial 13 bold', text = 'EXIT' ,padx =5,bg ='seashell4'
,command = Exit).place(x=230,y=310) [Link]()
pg. 10
Output
pg. 11
Conclusion
The project successfully developed the rock-paper-scissors game using
python. It used Tkinter library for rendering graphics. It use a random
module to generate random choices. I learn how to create button widget.I
also learn how to call the function using button. In this way, I created a
rock-paper-scissors python game.
Reference
▪ [Link]
▪ [Link]
+python
▪ [Link] ▪
[Link]
pg. 12