Answer to Question #253446 in Python for Kevin

Question #253446
Problem Definition: Draw an algorithm and write the equivalent Python Code that takes two integers as parameters representing a month and day and that returns a String indicating the season for that month and day. Assume that months are specified as an integer between 1 and 12 (1 for January, 2 for February, and so on) and consider the value of day between 1 and 31. If the date falls between 12/16 and 3/15, you should return "Winter". If the date falls between 3/16 and 6/15, you should return "Spring". If the date falls between 6/16 and 9/15, you should return "Summer". And if the date falls between 9/16 and 12/15, you should return "Fall".
Furthermore, the typical temperature for each season will be applied and the temperature values are according to the temperature Celsius and Fahrenheit. Kindly see the figure shown below for your reference.
Typical Temperatures
1
Expert's answer
2021-10-19T16:19:26-0400
month = int(input("Enter the month: "))
day = int(input("Enter the day: "))


if month in (1, 2, 3):
	season = 'winter'
elif month in (4, 5, 6):
	season = 'spring'
elif month in (7, 8, 9):
	season = 'summer'
else:
	season = 'autumn'


if (month == 3) and (day > 19):
	season = 'spring'
elif (month == 6) and (day > 20):
	season = 'summer'
elif (month == 9) and (day > 21):
	season = 'autumn'
elif (month == 12) and (day > 20):
	season = 'winter'


print("Season is",season)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS