SyntaxFix
Write A Post
Hire A Developer
Questions
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]