Codington
0 of 6 problems solved • 0%

Exercise prompt

Repair the Peak Register

A station log records the highest temperature seen at each stop. The starter invents a zero reading at stations with only negative measurements.

Example

Start a minimum from an actual observation.

waits = [14, 8, 12] shortest = waits[0] for wait in waits[1:]: shortest = min(shortest, wait) print(shortest) # 8

An invented initial zero would win against every positive wait. When measurements belong to different stations, initialize each new group from its own first observation.

Your task

Repair station_peaks(readings). Each record has station and temperature fields. Return a dictionary with the highest observed temperature per station, even if all its readings are negative.