Modifying each element in a list in a function


It keeps giving me the error "Oops, try again. double_list([0, 1]) returned [0, 1] instead of [0, 2]" please, help!
Create a function called double_list that takes a single argument x (which will be a list) and multiplies each element by 2 and returns that list. Use the existing code as a scaffold

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)


a function ends the moment a return keyword is reached, if the return keyword is reached in a loop, the loop simply breaks so the function can end


Ahhhh i seee....i got it after i re-read what you said a couple of time.