Skip to main content

snake, water and gun Game in Python

 





import random

c = ["s","w","g"]
print("-------- [ Welcome to Snake Game ] ---------")
n = int(input("How many match do you want to play: "))
cincrease = 0
hincrease = 0
match = 1
while match<=n:
    cchoice = random.choice(c)
    hchoice = input("Your choice [ (w) | (s) | (g) ] ")
    if cchoice ==  hchoice:
        print("------Drow------\n")
    elif cchoice == "s" and hchoice =="w":
        print("------Computer won------\n")
        cincrease+=1
    elif cchoice == "s" and hchoice =="g":
        print("------You won------\n")
        hincrease+=1
    elif cchoice == "w" and hchoice =="g":
        print("------Computer won------\n")
        hincrease+=1
    elif cchoice == "w" and hchoice =="s":
        print("------Your won------\n")
        hincrease+=1
    elif cchoice == "g" and hchoice =="s":
        print("------Computer won------\n")
        cincrease+=1
    elif cchoice == "g" and hchoice =="w":
        print("------Your won------\n")
        hincrease+=1
    else:
        print("Error")
   
    match+=1



print("Total score of Computer is: ",cincrease)
print("Total score of Your is: ",hincrease)
print("\n")
if cincrease<hincrease:
    print("--------------------")
    print("You won the Game")
    print("--------------------")
elif cincrease==hincrease:
    print("Game is Drow")
else:
    print("--------------------")
    print("Computer won the Game")
    print("--------------------")




Comments