WATER GUN AND SNAKE GAME IN PYTHON



import random

list = ["snake", "water", "gun"]
computercount=int(0)
mancount=int(0)
cwin=int(0)
mwin=int(0)

for i in range(0,10):

print("Enter Your Choice S or W or G ")

userinput = str(input())

if (userinput == 's' or userinput == 'S' ): #value er moddhe or hoi na condition er moddhe or hoi
store = "snake"
print("snake")

elif (userinput == 'w' or userinput == 'W'):
store = "water"
print("water")

elif (userinput == 'g' or userinput == 'G'):
store = "gun"
print("gun")
else:
print("You put wrong latter")
break


cpustore = random.choice(list)

if (store == "snake" and cpustore == "gun"):
cwin = 1
mwin=0
print("Cpu choose Gun He win")


elif (store == "snake" and cpustore == "water"):
mwin = 1
cwin=0
print("Cpu choose water you win")

elif (store == "water" and cpustore == "snake"):
cwin = 1
mwin=0
print("Cpu choose snake He win")


elif (store == "water" and cpustore == "gun"):
mwin = 1
cwin=0
print("Cpu choose Gun You win")


elif (store == "gun" and cpustore == "snake"):
mwin = 1
cwin=0
print("Cpu choose Snake You win")

elif (store == "gun" and cpustore == "water"):
cwin = 1
mwin=0
print("Cpu choose water He win")

elif (store == cpustore):
print("draw this time")
cwin = 0
mwin=0

computercount = computercount + cwin
mancount = mancount + mwin


if (computercount > mancount):
print(f"computer win {computercount} times")
print(f"you win {mancount} times")
print("computer win the game")

elif (mancount > computercount):
print(f"computer win {computercount} times")
print(f"you win {mancount} times")
print("You win the game")

else:

print("match draw") 

Comments

Popular posts from this blog

D WEB LINK