Modifying Each Element in a List (12.13)


I am stuck on Modifying each element in a list.

My code prints:
[6, 10, 14]

This output appears to be correct to me, but I am getting the error message:
Oops, try again. double_list([0, 1]) resulted in an error: list index out of range

Here is my code:
n = [3, 5, 7]
def double_list(x):
    for i in range(0, len(n)):
        x[i] = x[i] * 2
    return x
print double_list(n)



for i in range(0, len(n)):

because you use len(n) this function will only work for you fixed list n, not any list that is passed into the function parameter (x)


Thank you so much for your help!
That worked