Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Itertool's groupby and sum solution in Clear category for Sum Consecutives by kkkkk
from itertools import groupby
def sum_consecutives(num_list):
"""Return sums of consecutive numbers in given list."""
return [sum(g) for _, g in groupby(num_list)]
Oct. 9, 2019