Snake Water Gun Game In Python 🐍🐍🐍

 



import random  # importing built in module

i = 1

while i <= 10:

    lst = ["snake", "water", "gun"]

    computerInput = random.choice(lst)

    # print("computer choice:",computerInput)
    print("**************** Welcome To Snake-Water-Gun ***************************")
    print("press 0 for exit")
    userInput = input("Enter your choice:")

    if userInput == '0':
           
            confirm = input("are you sure press y or n:")
            if confirm == 'y':
                break
            else:
                    # userInput = input("Enter your choice:")

                    if computerInput == 'snake' and userInput == 'water':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'snake' and userInput == 'gun':
                        print("you win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'water' or computerInput == "snake" and userInput == "snake" or computerInput == 'gun' and userInput == "gun":
                        print("noone win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'gun':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'snake':
                        print("you win, because computer choose", computerInput)
                    elif computerInput == 'gun' and userInput == 'snake':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'gun' and userInput == 'water':
                        print("you win, because computer choose", computerInput)
    else:
                    if computerInput == 'snake' and userInput == 'water':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'snake' and userInput == 'gun':
                        print("you win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'water' or computerInput == "snake" and userInput == "snake" or computerInput == 'gun' and userInput == "gun":
                        print("noone win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'gun':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'water' and userInput == 'snake':
                        print("you win, because computer choose", computerInput)
                    elif computerInput == 'gun' and userInput == 'snake':
                        print("computer win, because computer choose", computerInput)
                    elif computerInput == 'gun' and userInput == 'water':
                        print("you win, because computer choose", computerInput)

                    i=i+1

Post a Comment

0 Comments