Rounding
Ron Provost
ron.longo at cox.net
Tue Dec 18 15:21:31 EST 2007
Adding 0.5, then converting to an int always works for me.
>>> x = 6.345
>>> int( x + 0.5 )
>>> 6
Ron
----- Original Message -----
From: "katie smith" <iceboy127 at yahoo.com>
To: <python-list at python.org>
Sent: Saturday, December 15, 2007 9:09 AM
Subject: Rounding
> if i have a number 6.345 and i wanted it to be 6 without subtracting .345
> because it won't always be .345 what do i do?
>
> how do i round to the nearest whole number. Or in this case round down. Is
> there an easy way to round down to the nearest whole number?
>
>
>
> ____________________________________________________________________________________
> Never miss a thing. Make Yahoo your home page.
> http://www.yahoo.com/r/hs
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list