Traceback (most recent call last):
File "python", line 13, in
File "python", line 8, in double_list
IndexError: list index out of range
I expect the "i" in the "for i in x:" loop to take the value of each index of the x list starting from 0 until the last. However, this is not the case. It seems to take a value higher than 2 as my list has 3 elements on it and I get the "index out of range" message.
n = [3, 5, 7] # Don't forget to return your new list! def double_list(x): for i in x: x[i] *= 2 return x double_list(n)