Rock Paper Scissor Game in Python
Rock
Paper Scissor Game in Python
import random
Moves=["rock","paper","scissor"]
while True:
ccount=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:
un="rock"
elif userInput==2:
un="scissor"
elif userInput==3:
un="paper"
cn=random.choice(Moves)
if cn==un:
print("Computer Value",cn)
print("User Value",un)
print("Game Draw")
ucount=ucount+1
ccount=ccount+1
elif (un=="rock"
and cn=="scissor")
or (un=="paper" and
cn=="rock") or (un=="scissor" and
cn=="paper"):
print("Computer Value", cn)
print("User Value", un)
print("You Win")
ucount=ucount+1
else:
print("Computer Value", cn)
print("User Value", un)
print("Computer Win")
ccount = ccount + 1
if ucount==ccount:
print("Final Game Draw..")
print("User Score",ucount)
print("Computer Score",ccount)
elif ucount>ccount:
print("Final You Win")
print("User Score", ucount)
print("Computer Score", ccount)
else:
print("Final Computer Win")
print("User Score", ucount)
print("Computer Score", ccount)
else:
break
<<Try yourself>>
Post a Comment