-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockPaperScissor.py
More file actions
60 lines (59 loc) · 1.37 KB
/
rockPaperScissor.py
File metadata and controls
60 lines (59 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import random
l=["rock","scissor","paper"]
'''
rock vs paper => paper wins
rock vs scissor => rock wins
paper vs scissor => scissor wins
'''
while True:
ocount=0
ucount=0
uc=int(input('''
Game Start.....
1 Yes
2 No | Exit
'''))
if uc==1:
for a in range(1,6):
userInput= int(input('''
1 Rock
2 Scissor
3 Paper
''' ))
if userInput==1:
uchoice="rock"
elif userInput==2:
uchoice="scissor"
elif userInput==3:
uchoice="paper"
Ochoice=random.choice(l)
if Ochoice==uchoice:
print("Opponent choice",Ochoice)
print("User choice",uchoice)
print("Game Draw")
ucount=ucount+1
ocount=ocount+1
elif(uchoice=="rock" and Ochoice=="scissor") or (uchoice=="paper" and Ochoice=="rock") or (uchoice=="scissor" and Ochoice=="paper"):
print("Opponent Choice",Ochoice)
print("User choice",uchoice)
print("You Win")
ucount=ucount+1
else:
print("Opponent Choice",Ochoice)
print("User choice",uchoice)
print("Opponent Win")
ocount=ocount+1
if ucount==ocount:
print("Final Game Draw....." )
print("User Score",ucount )
print("Opponent Score",ocount )
elif ucount>ocount:
print("Final You Win The Game....." )
print("User Score",ucount )
print("Opponent Score",ocount )
else:
print("Final Opponent Win The Game....." )
print("User Score",ucount )
print("Opponent Score",ocount )
else:
break