time_interval = [4, 6, 12]
I want to sum up the numbers like [4, 4+6, 4+6+12] in order to get the list t = [4, 10, 22].>
[4, 4+6, 4+6+12]
t = [4, 10, 22]
Without having to use Numpy, you can loop directly over the array and accumulate the sum along the way. For example:
a=range(10) i=1 while((i>0) & (i<10)): a[i]=a[i-1]+a[i] i=i+1 print a
Results in:
[0, 1, 3, 6, 10, 15, 21, 28, 36, 45]