Python question please include all steps and screenshot of code. Also please provide a docstring, and comments through the code, and test the given examples below. Thanks. Write function season() that takes as input the number of a month (1-12) and returns the season corresponding to the month, as a string. You may assume that numbers 1 to 3 correspond to Winter, 4 to 6 correspond to Spring, 7 to 9 correspond to Summer, and 10 to 12 correspond to Fall. If anything other than the integers 1 through 12 are entered the program should print the message ‘This is not a valid entrée’. Use a dictionary and exception handling. >>> season(3) 'Winter' >>> season(11) 'Fall' >>> season(0) This is not a valid entrée
Python question please include all steps and screenshot of code. Also please provide a docstring, and comments through the code, and test the given examples below. Thanks.
Write function season() that takes as input the number of a month (1-12) and returns
the season corresponding to the month, as a string. You may assume that numbers 1 to 3
correspond to Winter, 4 to 6 correspond to Spring, 7 to 9 correspond to Summer, and 10
to 12 correspond to Fall. If anything other than the integers 1 through 12 are entered the
program should print the message ‘This is not a valid entrée’. Use a dictionary and
exception handling.
>>> season(3)
'Winter'
>>> season(11)
'Fall'
>>> season(0)
This is not a valid entrée
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images