Problem 146669 · easy · Phase 01 Prerequisites & Setup

Month to Season

conditionals · ranges

Write season(month) that takes a month number (1 = January, 12 = December) and returns the northern-hemisphere season: "winter" for December, January and February; "spring" for March to May; "summer" for June to August; "autumn" for September to November. Return "invalid" if the number is not a month.

Examples

Input:  month = 1
Output: "winter"

Input:  month = 7
Output: "summer"

Input:  month = 13
Output: "invalid"

Constraints

  • month is an integer

Goals

  • Map a number onto categories with or / chained comparisons
  • Handle a group that wraps around the end of the year
Starting Python…