Determine the season based on the month
Write a program that takes a string input representing a month and prints the corresponding season. Assume that:
- December, January, and February are winter months (print
"Winter"
) - March, April, and May are spring months (print
"Spring"
) - June, July, and August are summer months (print
"Summer"
) - September, October, and November are fall months (print
"Fall"
)
Print "Invalid month"
if an invalid month is entered.
Instructor solution
Think you've got it?
What is the purpose of the final else
statement in the season determination program?
- A.
To check whether all conditions are
false
. - B.
To execute the same code block for multiple conditions.
- C.
To handle the case where the input does not match any of the expected months.
- D.
To repeat a block of code a certain number of times.
You may exit out of this review and return later without penalty.