Q: A run is a sequence of adjacent repeated values. Given a list, write a function to determine the length of the longest run. For example, for the sequence [1, 2, 5, 5, 3,
You can do this in one line using itertools.groupby:
itertools.groupby
import itertools max(sum(1 for _ in l) for n, l in itertools.groupby(lst))