Make sure you’re not just blindly copying code. Most of the python suggestions contain the solution but still need to be modified in order to work properly.
Simple python solution:
m = 0
out = []
for n in IN[0]:
m = m+n
out.append(m)
OUT = out
Simple DesignScript solution:
Math.Sum(List.TakeItems(nums,1..List.Count(nums)));