On Mon, 12 Oct 2009 11:33:31 -0700, Victor Subervi <victorsube...@gmail.com> wrote:

Hi;
I have the following code:

    for row in data:
      i += 1
      total = 0
 [snip]
As you can see, the total doesn't accumulate! There are two rows. The second
"Total 1:" should show "1.98", not 0! What gives?

You are setting total = 0 inside the for loop, so it is getting rebound for every row...

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

Reply via email to