Re: Multiplication error in python

2011-09-27 Thread sakthi
On Sep 27, 1:43 pm, Chris Rebert wrote: > On Tue, Sep 27, 2011 at 10:21 AM, sakthi wrote: > > In the following code, > >>>> l=[1,2,3,4,5] > >>>> i=0 > >>>> for a in l: > > ...     p=2*a > > ...     t=p+i > > ...     i=t >

Multiplication error in python

2011-09-27 Thread sakthi
In the following code, >>> l=[1,2,3,4,5] >>> i=0 >>> for a in l: ... p=2*a ... t=p+i ... i=t ... >>> t 45 Python gives an answer as 45. But i am getting 30 when i execute manually. Is there any different multiplication pattern in python? Thank yu. -- http://mail.python.org/mailman/lis