Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
3-lines: zips and slices solution in Clear category for Group Equal consecutive by Phil15
def group_equal(els):
diff = [i+1 for i,(a,b) in enumerate(zip(els, els[1:])) if a!=b]
return [els[i:j] for i,j in zip([0] + diff, diff + [len(els)]) if i
Oct. 29, 2018
Comments: