Skip to main content
🐍 Python Projects

Temperature Stats

What you're building

A TemperatureStats class that ingests a list of daily temperatures and computes useful statistics β€” the kind of thing a weather app backend runs constantly.

Requirements

  • minimum() β€” lowest reading
  • maximum() β€” highest reading
  • average() β€” mean, rounded to 2 decimal places
  • above_average() β€” list of readings strictly above the mean (original order)
ts = TemperatureStats([72, 68, 85, 90, 61])
ts.minimum()       # 61
ts.maximum()       # 90
ts.average()       # 75.2
ts.above_average() # [85, 90]

Stretch goals

  • trend() β€” returns "rising" if the last reading is above average, else "falling".
  • hottest_streak() β€” length of the longest run of readings above average.

What this proves

Working with numeric lists, built-in functions (min, max, sum), and list comprehensions β€” exactly what data-pipeline interviews test.

⚑ 50 XP
solution.pyRuns in your browser (Pyodide)
Loading editor…
Tests4 to pass
minimum returns lowest
maximum returns highest
average rounded to 2 places
above_average filters correctly

Run your code to check these.