Why does this function cause a Maximum recusion error?

python, python-2.7

Solution

Because in your `double_list` you are calling `double_list` again?

return double_list(x)

That will cause you to enter the endless loop unless you set a condition in which it should break upon.

OP already solved it, and this is his solution:

n = [3, 5, 7]

def double_list(x):
    for i in range(0, len(x)):
        x[i] = x[i] * 2
    return x

print double_list(n)

Problem

I have a very simple function in python that I made while using codecademy.com. The code passed the exercise but it does cause a maximum recursion error and I do not understand why. This is what I have: ``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return double_list(x) print double_list(n) ```

Original source