Cumulative sum of list in dynamo


#1

Hi . I am trying to make a cumulative sum of the list. For example i have a list with numbers 1, 2, 3, 4 and i want to create new list that would be 1, 3, 6, 10 … i searched the internet for python script but nothing has worked in dynamo. <span style=“color: #555555;”> I would like to just set one variable, connect it to the list, and then new variable of new list that i could drag and work with it</span>

I found this on the internet but i cant implement it in dynamo:

http://www.sohua.xyz/questions/348802/how-to-find-the-cumulative-sum-of-numbers-in-a-list
<pre class=“prettyprint prettyprinted”>


#2

That should be pretty straight forward:

 

 

 

 

First we create multiple ranges - the first item, first and second, first to third, etc. Then we sum each new list an we get the final result.


#3

There is also an OOTB node which works nicely, List.Scan. Also a Lunchbox node which does the same, but without the seed input:


#4

Thank you guys you helped me. This is the result