[Tutor] very odd math problem
ALAN GAULD
alan.gauld at btinternet.com
Fri Mar 11 15:28:57 CET 2011
> >> The right way is to do it like this:
> >>
> >> >>> x = 0.0
> >> >>> for i in range(1, 11):
> >> ... x = i*0.1
> > But this I don't understand.
> > Why would you use a loop when the final value is just
>
> What you missed was the original context, where other work was being
> done in the loop, and where the accuracy of the "accumulator" was being
> misunderstood.
Ah yes, I confess I didn't read the OPs code in detail, I was more interested
in Steven's reply. If other things are happening in the loop then that explains
things.
Thanks Dave.
Alan G.
More information about the Tutor
mailing list