I'm working on a program and I need to use a while loop to re open input box if user receives Date not found, please try a different date
def ask_rain_date():
date_rain_dict = seattle_weather.groupby('DATE')['RAIN'].apply(list).to_dict()
rain_date_input = input("Seattle is always rainy! Check to see if it was raining on a date between 1948-2017!\n FORMAT Y-M-D: ")
user_input = (rain_date_input)
if user_input in date_rain_dict:
date_input = (date_rain_dict[user_input])
if date_input == [True]:
print('It was raining!')
elif date_input == [False]:
print('It was not raining!')
else:
print('Date not found, please try a different date.')
ask_rain_date()
I've tried using different variations of while
outside of the if statement but it's not working. I imagined maybe doing something like: while user_input <= True or user_input <= False
would be it. All the help is appreciated in advance!