Below is a python script to create a running total of the numbers from the list it receives. I need this to work on sub-lists (currently it only works on a flat list). Can anyone provide direction on how to accomplish this? Thanks.
list = IN[0]
mass = 0
masspart = []
if hasattr(list, "__iter__"):
for i in range(0,len(list)):
mass = mass + list[i]
masspart.append(mass)
else:
masspart.append(list)
OUT = masspart
Thanks, It is actually the “Partials” output i am looking for, but the lacing works for that as well in the Lunchbox node.
I usually try to avoid putting in nodes from packages to make it easier for the people that will be using the scripts (I can barely get them to run the correct version of dynamo, telling them to install packages is just extra effort), so I will use the logic from the code you posted to try to get the partials to work in just the python node.
Thanks for the help.