a little bit of recursion

Dominik Kaspar dokaspar at student.ethz.ch
Tue Oct 21 15:47:59 EDT 2003


I'm trying to write a quite big recursive function, but the baseline
is the following:

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

print rek(0, [])

Why isn't this working?
In my opinion it should return [1, 2, ..., 9]

Thanks for any answers.
Dominik




More information about the Python-list mailing list