I'm trying to implement custom validation... My goal is that if the user's response is not "Y", or not "N", or not "Q", they loop back to the top. Otherwise break.
Both options I've tried will continue to loop even when the the correct response is given.
Here's what I've tried: Option 1:
""" Use custom validation. """
while True:
n_put = input('Would you like to perform a new Google image search?' + user_options())
if n_put is not "Y" or not "N" or not "Q":
print('Invalid response. Please read the prompt carefully. ')
else:
break
Option 2:
""" Use custom validation. """
while True:
n_put = input('Would you like to perform a new Google image search?' + user_options())
if n_put is not any(["Y", "N", "Q"]):
print('Invalid response. Please read the prompt carefully. ')
else:
break