Count consecutive ones in a binary list
Both your and janos' implementations are broken:

data = [1, 0] * 10000
consecutive_one(data)
#&gt;&gt;&gt; 140


This is because you don't always reset after seeing a 0. Going from janos', you should have

longest = 0
current = 0
for num in data:
    if num == 1:
        current += 1
    else:
        longest = max(longest, current)
        current = 0

return max(longest, current)


and equivalent for the original.

You'll find that this functionality is largely provided by itertools.groupby, though:

from itertools import groupby

def len_iter(items):
    return sum(1 for _ in items)

def consecutive_one(data):
    return max(len_iter(run) for val, run in groupby(data) if val)