This is a really basic question, and I apologize for its simplicity, but I have been searching for the answer and trying different syntax for hours without luck.
I am using python to create a text menu for a cipher program. I am using a while loop for an error message when an invalid key is pressed, but it loops even when the condition is false.
purpose = input("Type 'C' for coding and 'D' for decoding: ")
while purpose.upper() != "D" or "C":
purpose = input("Error, please type a 'C' or a 'D': ")
if (purpose.upper() == "C"):
do_something()
if (purpose.upper() == "D"):
do_something()
For some reason the error message is displayed regardless of key press. Thank you so much for the help!