On 18 Mar, 00:58, Jeff Schwab <[EMAIL PROTECTED]> wrote: > def make_slope(distance, parts): > if parts == 0: > return [] > > q, r = divmod(distance, parts) > > if r and parts % r: > q += 1 > > return [q] + make_slope(distance - q, parts - 1)
Beautiful. If Python could optimize tail recursion, it would even run fast. -- http://mail.python.org/mailman/listinfo/python-list