[Tutor] quick question

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Sep 28 11:03:37 CEST 2012


On 28/09/2012 06:18, jh wrote:

[snip]

> The subtotal of your items is: 26010.850000000002
> The total amount of your items plus tax is: 27,571.50
>
> My question here is, why does my subtotal have so many decimals when I never
> went above 2 in my input?
>
> Thanks in advance,
> J

Brett Ritter has already answered your question, but a web search would 
have found the answer a lot faster, as this has been asked umpteen times 
on Python lists alone.  Also note that if you'd have formatted the 
output in the same way that you did for the total you'd never have noticed.

-- 
Cheers.

Mark Lawrence.



More information about the Tutor mailing list