[Tutor] Binary Real to Decimal

John Fouhy john at fouhy.net
Mon Mar 30 05:46:57 CEST 2009


2009/3/30 Chris Castillo <ctcast at gmail.com>:
> that is what I have so far but I need to create a condition where I need
> only 10 sufficient numbers from the variable decnum2. I know I need
> something like
> if len(decnum2) > 11:
>     decnum2 = decnum2[0:11]

Perhaps the round() function will help?

>>> round(12345, -2)
12300.0

-- 
John.


More information about the Tutor mailing list