Access to items across list in python or vb in grasshopper


In the list shown above i want to add each number to all previous numbers in the list (Like a cumulative addition)
I am new into scripting in grasshopper.
Any help is appreciated.Thanks

Have a look at the mass addition component

1 Like

In Python you would do this:

a=[sum(x[:i+1]) for i in range(len(x))]

1 Like

Sorry ! I missed the +1 - corrected above!

1 Like