I am trying to make a hangman game, using 'or' in a while loop to check the input of the user. Without the 'or' the loop works fine, but when I add or with another condition, the output is always false.
def Guess():
guess = input("Type 'guess' to guess a character or 'answer' to guess the answer:\n>")
while guess != 'guess':
guess = input("That is an invalid input. Please type 'guess' to guess a character or 'answer' to guess the answer:\n>")
This code works normally - if I input 'guess', the loop ends.
def Guess():
guess = input("Type 'guess' to guess a character or 'answer' to guess the answer:\n>")
while guess != 'guess' or guess != 'answer':
guess = input("That is an invalid input. Please type 'guess' to guess a character or 'answer' to guess the answer:\n>")
When I add this, no matter what I input the loop will always keep running. Any ideas what is going wrong?