Editor

Dress for the Weather

#507 · Python Basics · Beginner · 25 XP · about 3 min

A weather app describes the temperature with one word. Write weather_word(celsius) that returns that word for a temperature in degrees Celsius:

  • below 0: 'freezing'
  • from 0 up to but not including 10: 'cold'
  • from 10 up to but not including 20: 'mild'
  • from 20 up to but not including 30: 'warm'
  • 30 or more: 'hot'

Examples

weather_word(-5)   # returns 'freezing'
weather_word(15)   # returns 'mild'
weather_word(30)   # returns 'hot'
weather_word(9.9)  # returns 'cold'

Note

celsius can be a whole number or a decimal, and it can be negative.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.