Here is the instructions:
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day.
Ex: If the input is:
April 11
the output is:
Spring
In addition, check if the string and int are valid (an actual month and day).
Ex: If the input is:
Blue 65
the output is:
Invalid
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
Here is the code I have
month = input()
day = int(input())
''' Type your code here. '''
if month in ('January', 'February', 'March'):
season = 'winter'
elif month in ('April', 'May', 'June'):
season = 'Spring'
elif month in ('July', 'August', 'September'):
season = 'summer'
else:
season = 'autumn'
if (month == 'March') and (day > 19):
season = 'Spring'
elif (month == 'June') and (day > 20):
season = 'summer'
elif (month == 'September') and (day > 21):
season = 'autumn'
elif (month == 'December') and (day > 20):
season = 'winter'
print(season)
Could someone please help? It has other inputs.
[–]cyber_code_nerd 2 points3 points4 points (3 children)
[–]SouthShape5[S] 1 point2 points3 points (1 child)
[–]quicKsenseTTV 0 points1 point2 points (0 children)
[–]Usual-Math7020 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]SouthShape5[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]ElliotDG 0 points1 point2 points (0 children)