Erik Max Francis wrote:
> Micah Elliott wrote:
> 
>>On Nov 21, David Isaac wrote:
>>>What's the good way to produce a cumulative sum?
>>
>>>>>import operator
>>>>>x = 1,2,3
>>>>>reduce(operator.add, x)
>>
>>6
> 
> Or just sum(x).

That just gives you the tail end. The OP asked for a cumulative sum;
that is, a list with all of the intermediate sums, too.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to