- Joined
- Jan 18, 2025
- Messages
- 1
- Reaction score
- 0
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")
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")