Jan-18-2025, 12:53 PM
(This post was last modified: Jan-18-2025, 07:24 PM by Gribouillis.)
I am trying to limit a user's input to either the letter y or n. I am using this code. However, even when I enter n or y it still loops. I would appreciate someone letting me know where I have gone wrong! Thank you very much.
while parking_pass != 'n' or 'y': print ("Error Contains illegal characters") print("Would you like a free parking pass y/n?") parking_pass = str(input()) else: print("Your parking pass has been added to your order")
Gribouillis write Jan-18-2025, 07:24 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.