[Python] How do I check if an input matches an exact word [closed]

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    x = input("door:")
    if "key" in x:
    print("opened")
    else:
    print("closed")


    When someone puts a word that contains the word "key", like "donkey" or "monkey", it prints "open" but I want them to use the exact word "key".

    Continue reading...

Compartilhe esta Página