0

I am trying to make my input were it will accept lower or upper case yes or no from the keyboard.

 a = input("Would you like to spin the wheel?Enter yes/no to continue\n")
    if a == "yes":
      play_game(count)

    if    a =="no":
            exit()
    else: 
    if    a != "yes" or a != "no":
            print_pause("Please enter in a valid input. yes/no\n")
            input()
  • instead of limiting input .. your if condition should check case-insensitively, i.e `if a.lower() == "yes"` and similarly `a.lower() == "no"`. or just replace a with `a = a.lower()` and then keep all checks in lower case. – ruhaib Aug 20 '19 at 10:15
  • Possible duplicate of [Need Python to accept upper and lower case input](https://stackoverflow.com/questions/28406568/need-python-to-accept-upper-and-lower-case-input) – palvarez Aug 20 '19 at 14:42

1 Answers1

0

Strings in python have a lower method. Convert the input to all lower case and compare the result.

if a.lower() == 'no':
    ...
Holloway
  • 6,412
  • 1
  • 26
  • 33