Mikael Olofsson wrote: > Michael Sparks wrote: > >> def approx(x): >> return int(x+1.0) > > I doubt this is what the OP is looking for. ... > Others have pointed to math.ceil, which is most likely what the OP wants.
I agree that's "likely" but, as Michael pointed out in the text you removed, his version does do what the OP's spec states, when interpreted literally. Very likely there's a language issue involved, and Michael was aware of that as well, I'm sure. Still, others had already posted on math.ceil(), so Michael was just trying to make sure that the OP realized his specification was inadequate and -- just in case he wanted something other than math.ceil -- he provided a valid alternative. -Peter -- http://mail.python.org/mailman/listinfo/python-list