Codington
0 of 6 problems solved • 0%

Exercise prompt

Summarize One Day

Daily reports use the lowest and highest reading plus the number of observations. Duplicates are separate observations. For a day with no readings, no range is available.

Example

A station uses the difference between its highest and lowest readings to measure the spread.

values = [9, 4, 10, 4] spread = max(values) - min(values) print(spread, len(values)) # 6 4

Repeated measurements still contribute to the count. Check whether any measurements exist before asking for a minimum.

Your task

Implement daily_summary(values). For a nonempty list of numbers, return a dictionary with low, high, and count. For an empty list, return None.

daily_summary([0.0, -1.5, 0.0]) # {"low": -1.5, "high": 0.0, "count": 3}