On Apr 11, 4:37 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > bdsatish wrote: > > The built-in function round( ) will always "round up", that is 1.5 is > def rounded(v): > rounded = round(v) > if divmod(v, 1)[1] == .5 and divmod(rounded, 2)[1] == 1: > if v > 0: > return rounded - 1 > return rounded + 1 > return rounded > > last = None > for n in range(-29, 28): > x = n * .25 > r = xr(x) > if r != last: > last = r > print > print '%s->%s' % (x, xr(x)), >
Hi Scott, This is what I was looking for.. I forgot about divmod( ) thanks for reminding. -- http://mail.python.org/mailman/listinfo/python-list