Have to write a program that when you input the month & day, it will output the correct season.
The dates for each season are: spring: March 20 - June 20
summer: June 21 - September 21
autumn: September 22 - December 20
winter: December 21 - March 19
If it doesn't match anything above, to print "Invalid"
input_month = input()
input_day = input()
if input_month in ('April', 'May'):
print('spring')
elif input_month in ('July', 'August'):
print('summer')
elif input_month in ('October', 'November'):
print('autumn')
elif input_month in ('January', 'February'):
print("winter")
elif input_month == 'June' and (input_day == range(1, 20)):
print("spring")
elif input_month == 'June' and (input_day == range(21, 30)):
print("summer")
elif input_month == 'September' and (input_day == range(1, 21)):
print("summer")
elif input_month == 'September' and (input_day == range(22, 30)):
print("autumn")
elif input_month == 'December' and (input_day == range(1, 20)):
print("autumn")
elif input_month == 'December' and (input_day == range(21, 31)):
print("winter")
elif input_month == 'March' and (input_day == range(1, 19)):
print("winter")
elif input_month == 'March' and (input_day == range(20, 31)):
print("spring")
else:
print("invalid")
If I input anything from the lines without the "and", it works perfect. I've tried parentheses, changing the order of the statements. Anything that includes the "and" statement prints "Invalid"
I have tried changing the '==' for the second input of the and statements to an 'in', still invalid output. I've tried changing some of the elif statements to if, and still invalid.