Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Use itertools.groupby to break into groups, then sum them solution in Clear category for Sum Consecutives by Fermax
import itertools
def sum_consecutives(a):
# Use itertools.groupby to break into groups, then sum them
return [sum(g) for k, g in itertools.groupby(a)]
Sept. 13, 2019