cesco <[EMAIL PROTECTED]> writes:
> I have the following list:
> l = [1, 2, 3, 4]
> and I'd like to obtain a list like the following:
> l_partial_sum = [1, 3, 6, 10] (that is [1, 1+2, 1+2+3, 1+2+3+4])
> 
> Is there a simple way to accomplish this?

I won't show explicit code since you are apparently asking a homework
question.  But Python style tends to prefer doing this sort of thing
imperatively, possibly using generator functions.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to