Coat Advice
Easy · simulation
A weather app tells you what to wear. You are given a list temps of morning temperatures in degrees Celsius, one for each day of the week ahead.
For each temperature, the app gives one piece of advice:
- below
0:"snowsuit" - from
0up to9:"coat" - from
10up to19:"jumper" - from
20up to29:"t-shirt" 30or more:"sun hat"
Return a list of strings with the advice for each temperature, in the same order as temps. If the list is empty, return an empty list.
Examples
Example 1
Input: temps = [-5, 4, 15, 22, 35]
Output: ["snowsuit", "coat", "jumper", "t-shirt", "sun hat"]
Each temperature falls into a different band.
Example 2
Input: temps = [0, 9, 10, 19, 20, 29, 30]
Output: ["coat", "coat", "jumper", "jumper", "t-shirt", "t-shirt", "sun hat"]
The edges of each band: 0, 10, 20 and 30 start a new band, while 9, 19 and 29 end one.
Example 3
Input: temps = []
Output: []
Constraints
- 0 <= len(temps) <= 1000
- -50 <= temps[i] <= 60