Season From Month Number

Easy ⏱ 8 min 73% acceptance ★★★★★ 4.9
Write a function season_for(month) that maps a month number (1-12) to a season string using the Northern Hemisphere convention: "Winter" for 12, 1, 2; "Spring" for 3, 4, 5; "Summer" for 6, 7, 8; "Autumn" for 9, 10, 11.

Examples

Example 1
Input
season_for(1)
Output
"Winter"
Explanation

January is Winter.

Example 2
Input
season_for(7)
Output
"Summer"
Explanation

July is Summer.

Constraints

  • 1 <= month <= 12.

Topics

Conditional Statementschained comparisons

Companies

UberAirbnb

Hints

Hint 1

Use chained/range comparisons like `3 <= month <= 5`.

Hint 2

Remember Winter wraps around from December to February.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.