I couldn't find a thread that was related. I am working on a seasons lab. I need to be able to take a month and day and print the season. It needs to print invalid for days that are not calendars days and strange inputs. I decided to use lists, but they keep printing out blank outputs. I am not sure where my code is just ending.
input_month = str(input()).lower() # make user input a lower case string
input_month = input_month.replace(' ', '') # remove spaces in user input
input_day = int(input()) # make user input a number
# list of seasons
spring = ['march', 'april', 'may', 'june']
summer = ['june', 'july', 'august', 'september']
autumn = ['september', 'october', 'november', 'december']
winter = ['december', 'january', 'february', 'march']
season = ['Spring', 'Summer', 'Autumn', 'Winter']
if input_month in spring: # "march" or 'april' or 'may' or 'june':
if (input_month == spring[0]) and (31 >= input_day > 19):
season = season[0]
print(season)
elif (input_month == spring[0]) and (1 <= input_day < 19):
season = season[3]
print(season)
elif (input_month == spring[3]) and (1 <= input_day < 21):
season = season[0]
print(season)
elif (input_month == spring[3]) and (31 <= input_day > 21):
season = season[1]
print(season)
elif (input_month == spring[1] or input_month == spring[2]) and (1 <= input_day <= 31):
season = season[0]
print(season)
else:
print('Invalid')
question from:https://stackoverflow.com/questions/65860166/link-index-printing-blank-python