a little bit of recursion

Georgy Pruss SEE_AT_THE_END at hotmail.com
Tue Oct 21 18:02:20 EDT 2003


"Gregor Lingl" <glingl at aon.at> wrote in message news:3F95A439.4060102 at aon.at...
>
> > <...>
> >
> >     def rek(N, L):
> >         N = N + 1
> >         if N >= 9:
> >             return L
> >         L.append(N)
> >         return rek(N, L)
> >
> > Skip
> >
> Nice, but will not append 9 as desired
> Gregor
> >
>

def rek(N, L):
    if N >= 9: return L
    N += 1
    L.append(N)
    return rek(N,L)

G-:

-- 
Georgy Pruss
E^mail: 'ZDAwMTEyMHQwMzMwQGhvdG1haWwuY29t\n'.decode('base64')






More information about the Python-list mailing list