Adding values within a list and create a new list

here we go,
list : 2,2,2,2,2

the output should be like this logic:
new list :
first item stays same: 2
second item: first item + second item = 2+2 = 4
third item : first + second + third = 2+2+2 =6 and so on.

final output: 2,4,6,8,10

any idea guys?

this list should be appropriate to attack:
list: 1500,800,2500,1100,3500,1400,4500,1700
ouput: 1500,(1500+800), (1500+800+2500)…and so on

You could try the simple solution outlined here:

Here’s a screenshot as applied to your example list.


Effective. thanks for the solution.
I have a question. What does the DSCore in the recursive node do? i mean you have written , 1…DSCore.List.Count(a)

It is necessary if one have a package installed that also have a list.count function etc. this specifies that it is the build in method that is required.
These two are the same:


It just accesses the Count function from the Design Script core used by Dynamo. You don’t need to worry about it :slight_smile:
As you can see from my screenshot, you don’t even have to write it for the count function to work.
Please mark the solution as solved.

yeah, i tried without DSCore and it worked before seeing the replies of its usage. Cool idea. ll mark it.

Thanks for the info. that’s an insight into the dynamo to know something exists…

I’ll take the liberty of moving the solution mark to the comment showing the solution provided by @sed07

1 Like

by the way, what’s the advantage of getting one’s comment, marked as solution. I am new to forum for posting questions, though i frequently seek help from the threads.

The advantage is that the solution will be moved to the top of the thread and that way people searching information does not have to scroll though a long thread if only the solution is indeed required :slight_smile: For someone there is no “advantage” except from the acknowledgement of having provided a work-able solution :slight_smile:

1 Like

thats nice to know. “Service” and knowledge sharing… thanks for the help guys… i will try to help as well.

1 Like