round down to nearest number

Chris Kaynor ckaynor at zindagigames.com
Thu Feb 9 20:40:12 EST 2012


On Thu, Feb 9, 2012 at 5:23 PM, noydb <jenn.duerr at gmail.com> wrote:

> hmmm, okay.
>
> So how would you round UP always?  Say the number is 3219, so you want
> 3300 returned.
>

You may want to look into the mathematical floor and ceiling functions[1].
Python exposes them in the math module as floor and ceil[2].

[1] http://en.wikipedia.org/wiki/Floor_and_ceiling_functions
[2] http://docs.python.org/library/math.html#math.floor and
http://docs.python.org/library/math.html#math.ceil


> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120209/d96475fd/attachment-0001.html>


More information about the Python-list mailing list