I'm trying to make input validation with limits to only allow 'y/Y' or 'n/N'
I can't get the while loop to close when performing two checks like this. (i.e. the loop continues even if you enter "Y/y' or 'N/n'.)
print('Would you like to play a game?')
play_a_game = input()
while play_a_game.lower() != 'y' or play_a_game.lower() != 'n':
print(play_a_game)
print('Invalid input')
print('Would you like to play a game?')
play_a_game = input()
But if I limit the while statement to one check, the loop exits fine. (i.e. the loop closes if you enter 'Y/y'.
print('Would you like to play a game?')
play_a_game = input()
while play_a_game.lower() != 'y':
print(play_a_game)
print('Invalid input')
print('Would you like to play a game?')
play_a_game = input()