On Wednesday 02 March 2005 06:03, actuary77 wrote: > It now makes sense if I write it, (simple): > > def rec2(n): > if n == 0: > return [] > else: > return [n] + rec2(n-1)
Or, if you're not interested in a recursive function to do this job (which should be way faster...): >>> def iter1(n): ... nl = range(1,n+1) ... nl.reverse() ... return nl ... >>> print iter1(4) [4, 3, 2, 1] -- --- Heiko.
pgpUjFecUi9hu.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list