Snake Water Gun Fun Program (without scoreboard) #Python

import random

code = ["s","g","w"]
codeValue = {"s""Snake",
            "g" : "Gun"
            "w" : "Water"}


play = int(input("Enter number of matches you want to play : "))
while(True):
    computerChoice = codeValue[random.choice(code)]
    userCode = input("Enter your Choice : ")
    userChoice = codeValue[userCode.lower()]
    
    if(userChoice == computerChoice):
        print(f"Your Choice = {userChoice}\nComputer's Choice = {computerChoice}\n")
        print("--TIE--\n")
    elif(userChoice == "Snake" and computerChoice == "Gun"):
        print(f"Your Choice = {userChoice}\nComputer's Choice = {computerChoice}\n")
        print("BAD LUCK!!\n")
    elif(userChoice == "Water" and computerChoice == "Snake"):
        print(f"Your Choice = {userChoice}\nComputer's Choice = {computerChoice}\n")
        print("BAD LUCK!!\n")
    elif(userChoice == "Gun" and computerChoice == "Water"):
        print(f"Your Choice = {userChoice}\nComputer's Choice = {computerChoice}\n")
        print("BAD LUCK!!\n")
    else:
        print(f"Your Choice = {userChoice}\nComputer's Choice = {computerChoice}\n")
        print("NICE MOVE!!\n")
        
    play = play -1
    if(play == 0):
        key = input("Enter Q to quit or any other key to Continue...\n")
        if(key.lower() == 'q'):
            print("THANKS FOR PLAYING\n")
            break 
        else:
            play = int(input("Enter number of matches you want to play : "))



Comments

Popular Posts