[Tutor] Convert from meters to British length units.
__peter__ at web.de
Mon Sep 17 12:52:17 CEST 2012
Johny Rei wrote:
[Please hit replay-all when you answer posts on this mailing list; that way
everyone on the list can see your post]
> Yes Sir, thank you sir,
You're welcome. Note that we're OK with a less formal tone over here ;)
> I do understand how this works, these is the printf formatting, Sir I
tried to apply the conversion from meter to feet that you recommend,
> Here's what i write from my code sir;
> >>>feet = 3.28
> >>>meter = float(input("meter ")) # py version 3.2
> meter 640
> >>>print ('Is it %g feet?' %(meter*feet))
> Is it 2099.2 feet?....
> Sir, It's bothering me enough about some of the area of the decimal point
from this numbers in a solution on a certain occasion especially when I'm
verifying in from computing because of i'am not so sure off whether is it
accurate, correct or not...sir whats your opinion from these?
> and Again, Thank you Sir,
If I understand you correctly you're bothered about rounding errors?
These are unavoidable with floating point numbers.
If you need exact results for the multiplication of decimal values you can
use the decimal module, see
However, the problem resurfaces as soon as you try to calculate something
like 1/3 that cannot be represented as a decimal number.
More information about the Tutor