0

I'm putting user's input into my variable and I want to check if the variable is one of the letters (Y, y, N or n) which user has inputted and if NOT ask him to enter the letter again. The script is entering the loop even if the letter is the correct (Y, y, N, n).

I've tried it with "If" and only the loop but still the same.

Loop only

while while save_to_file != "T" or save_to_file != "t" or save_to_file != "N" or save_to_file != "n":
    save_to_file = input("Ask the user to input the letter again... ")

Loop in the If

if save_to_file != "T" or save_to_file != "t" or save_to_file != "N" or save_to_file != "n":
    while True:
        save_to_file = input("Ask the user to input the letter again... ")
        if save_to_file == "T" or save_to_file == "t" or save_to_file == "N" or save_to_file == "n":
            break

Actual: The script is entering the loop/If even though it shoudln't. Expected: The script should skip the loop/If and go on.

Qiasm
  • 356
  • 6
  • 15

0 Answers0