mardi 21 janvier 2020

Why won't my 'else' statement work in python? [closed]

I am just started to create a hangman game. I don't understand why my "else" statement is not working.

Here is my code:

while True:
    guess = input("Guess one letter in the word!: ")

    if l[0] == guess:
        print("correct")
    elif l[1] == guess:
        print("correct")
    elif l[2] == guess:
        print("correct")
    elif l[3] == guess:
        print("correct")
    elif l[4] == guess:
        print("correct")
    elif l[5] == guess:
        print("correct")
    elif l[6] == guess:
        print("correct")
    elif l[7] == guess:
        print("correct")
    elif l[8] == guess:
        print("correct")
    elif l[9] == guess:
        print("correct")
    elif l[10] == guess:
        print("correct")
    elif l[11] == guess:
        print("correct")
    else:
        print("Incorrect")

Aucun commentaire:

Enregistrer un commentaire