question 69 Lists & Tuples · hard
The longest rainy streak
A station's daily record is a list of (date, precipitation) tuples, in date order. A rainy day has precipitation above 0. Find the longest run of rainy days in a row and print its length, first date and last date. If two runs are equally long, report the earlier one. If no day was rainy, print no rain.
Input
days, a list of (date, mm) tuples in date orderPrints
<length> days: <first date> to <last date>, or no rainTiesthe earlier run wins
Examplesthe starter's record →
3 days: 2024-01-05 to 2024-01-07Expected output1 line
- 13 days: 2024-01-05 to 2024-01-07