[Solved] Append cumulative list of lists python


One way to do this without itertools is to use Python’s sum function to concatenate lists.

>>> L =  [ [1], [2], [3], [4], [5], [6], [7] ]
>>> L_extend = [ sum(L[0:i+1], []) for i in range(len(L)) ]

2

solved Append cumulative list of lists python