runtime
69 / 500
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.

Inputdays, a list of (date, mm) tuples in date order
Prints<length> days: <first date> to <last date>, or no rain
Tiesthe earlier run wins
Examplesthe starter's record → 3 days: 2024-01-05 to 2024-01-07
Expected output1 line
  1. 13 days: 2024-01-05 to 2024-01-07

Loading your progress…

The longest rainy streak — Python practice · Runtime