[Tutor] Binary Real to Decimal

Chris Castillo ctcast at gmail.com
Mon Mar 30 06:17:53 CEST 2009


yeah that function would help but how would I join both sides again to get a
decimal real(float) to round?

for example myfloat = decnum1, ".", decnum2 doesn't work because the string
"." isn't a valid int type. how would I join those to be a float again?

On Sun, Mar 29, 2009 at 10:46 PM, John Fouhy <john at fouhy.net> wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090329/0d24de77/attachment.htm>


More information about the Tutor mailing list