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

Python Project

Uploaded by

ayushmaity7189
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Python Project

Uploaded by

ayushmaity7189
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

p

•sa..• •. ....•
"""""' . •.
••
-- - ~ • •
.----
·- --
··--==

• •

NAME:- Hrishita Dutta


CLASS:-XA
ROLL NO.:- 44
SCHOOL:- PM Shri KV Command
- •

S.NO TOPIC PG.NO T.SIGN


.,
I.
.,
ACKNO\VLEDGE~1ENT
-
-· Al~I OF THE PROJECT 3
-
3.
- EXPLANATION
- 4
-

4. INPUT 6

5. OUTPUT 7

6. BIBLI OGRAPHY 8

0
0

ACKNOWLEDGEMENT
1 would /1/ce to talce this opportunity to
extend my sincere gratitude and
appreciation to my computer lab teacher
Mr./Mrs. Abld.laslaa Dubey for providing
guidance and support throughout the
process of completing my computer
project for school.

1 am also than/cfu/ to my principal


Mr./Mrs. Mahato sir for al/owing me
the opportunity to explore and worlc on
this project In the school environment.

Addltlonally, 1 would /1/ce to express my


heartfelt than/cs to my fomlly for their
unwavering support ond encouragement
during the completion of this project.

Name: HrWdta Dutta

-
,1, r;7Y?' •
,,, ~
-
C

~
•i V Rock-Paper-Scissors Game Python Project
II' The object of the rock-paper-scissor python project
is to build a game for a single player that plays
with a computer, a101where, and anytime. Th.is
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
Th.is project is buUd using tkinter, random
modules, and the basic concept of python.

~--
~
,t,
0
c;;"i'
,1~~7Y?' 0

~,, ~

~~
C, WIN LOSE
)_.....,.
) I
, t>

)
)

:
._____,
~~~~'
- --- ,,.._, ~
~

~ ,t~
~~ ,/. .•.
0
0
,~,.~ .JV ~t'

'1" ,;~p' •
"t' ~
N
V~ Rock paper scissors (also
C, known by several other names
and word orders, see § Names)
is an intransitive hand game,
usually played between two
people, in which each player
simultaneously forms one of
three shapes with an
outstretched hand. These
shapes are "rock" (a closed fist), d
"paper" (a flat hand}, and ~ "

finger and middle finger extended~

" ''"
import random

def get _compL1ter _cho1ce ():


choices= [ ''rock'' , ''paper'' , ··sc1ssors'' ]
return random.choice(choices)

def de l erm I ne _w I nne,-( user _choice, computer _choice) :


if user_choice == computer_choice:
return "It's a tie!"
el1f (user_choice -- ··rock'' and computer_choice •• ··sc1ssors·· 1 or \
(user_choice -- "scissors" and computer_choice == "paper" ) or
( user _choice -- "paper" and computer _choice == "roe k" ):
return ''You win!''
else :
return ''Computer wins!''

def pl.iy _g.1m, () :


print ( "Rock, P<1per, Scissors Game!" )

# Get user choice


user_choice • input ( ''Enter your choice (rock, paper, or scissors) :
while user_choice not 1n ( ''rock'' , ''paper'' , ''sc1ssors'' ):
print ( ''lnval1d choice, please try again." )
user_choice = input ( ''Enter your choice (rock, paper, or scissor

# Get computer choice


computer_choice • get_computer_choice()
print ( f''Computer chose : {computer _cho1ce}'' )

# Determine winner
result = determine_winner(user_choice, computer_choice)
print (result)

_name -- " main


play_game()
Ouq,ut
Case 1: Player wins

Enter rock, paper, or scissors: rock


Computer chose: scissors
You win!

Case 2: It's a tie

Enter rock, paper, or scissors: paper


Computer chose: paper
It's a tie!

Case 3: Computer wins

Enter rock, paper, or scissors: scissors


Computer chose: rock
Computer wins!
~!" ,;7~, 0

"t' ~
~ ,-------------
<Bi6fiograpliy
., ~ 1. "'u,, 1.9cwgfe.com
,2. '(( lLTU '. tll. 1' 'ikJp1.'4lll. OfD
J. ,, 11·w.crfurpfus.com

' u rt .stat..'li..,ore,jToU'.co11,
./. tt 1

5. 0.>1r1puter Science 14._tfu"li..,cl.ss./(I d:, ,X ll -'By


SumitJ )'rora.

You might also like