As you can see in the following, my intention was to close the program once the user types either "x" or "X" and to ask again (loop) if not. Confusingly, the whole program closes anyway once I type anything but "x" or "X".
import sys
while True:
userAnswer = input("press x or X to exit")
if userAnswer == "x" or "X":
sys.exit()
It would be great if someone could explain this to me. Thanks