On Thu, Feb 9, 2012 at 5:40 PM, Chris Kaynor <ckay...@zindagigames.com>wrote:
> On Thu, Feb 9, 2012 at 5:23 PM, noydb <jenn.du...@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 > > I should have added, you can use multiplication and division to apply those functions to other digits rather than the base one. For example, multiply by 10, floor, divide by ten, will floor to one decimal point. > -- >> http://mail.python.org/mailman/listinfo/python-list >> > >
-- http://mail.python.org/mailman/listinfo/python-list