A weather diary has one word a day: "sun" or "rain". Write longest_streak(days) to return the most sunny days in a row. With no sunny days, or an empty list, return 0.
longest_streak(["sun", "sun", "rain", "sun"])→2longest_streak(["sun", "rain", "sun", "sun", "sun", "rain"])→3longest_streak(["rain", "rain"])→0def longest_streak(days):
best = 0
run = 0
for day in days:
# your code here: sun adds 1 to run (update best if
# run is bigger); rain sets run back to 0
pass
return best
Run tries the examples. When they look right, Submit.