Longest activity streak
Mediumfor loopmax· 20 XP
For each day, the app records 1 if the user was active and 0 if not. The streak badge needs the longest run of active days in a row.
Write a function longest_streak(days) that returns the length of the longest run of 1s in a row.
How it's checked
Your code runs, then the check below runs and its printed output is compared with ours.
longest_streak([1, 1, 0, 1, 1, 1, 0])returns3- A list with no
1s gives0
Hints, the later questions and the answer come with Pro.
def longest_streak(days):
...