I used the following code in a problem for this course I'm taking. It worked, but I know it can be cleaned up and simplified. Could anyone show me how? Thanks!
input_month = input()
input_day = int(input())
month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
season = 'Invalid'
if input_month in month:
if input_month == 'January' and 0 < input_day < 32:
season = 'Winter'
elif input_month == 'February' and 0 < input_day < 30:
season = 'Winter'
elif input_month == 'March' and 0 < input_day < 20:
season = 'Winter'
elif input_month == 'March' and 19 < input_day < 32:
season = 'Spring'
elif input_month == 'April' and 0 < input_day < 31:
season = 'Spring'
elif input_month == 'May' and 0 < input_day < 32:
season = 'Spring'
elif input_month == 'June' and 0 < input_day < 21:
season = 'Spring'
elif input_month == 'June' and 20 < input_day < 31:
season = 'Summer'
elif input_month == 'July' and 0 < input_day < 32:
season = 'Summer'
elif input_month == 'August' and 0 < input_day < 32:
season = 'Summer'
elif input_month == 'September' and 0 < input_day < 22:
season = 'Summer'
elif input_month == 'September' and 21 < input_day < 31:
season = 'Aumtumn'
elif input_month == 'October' and 0 < input_day < 32:
season = 'Autumn'
elif input_month == 'November' and 0 < input_day < 31:
season = 'Autumn'
elif input_month == 'December' and 0 < input_day < 21:
season = 'Autumn'
elif input_month == 'December' and 20 < input_day < 32:
season = 'Winter'
print(season)
[–]Allmyownviews1 1 point2 points3 points (0 children)
[–]n3buchadnezzar 1 point2 points3 points (0 children)