What is wrong with this? 12 list and functions


#1
n = [3, 5, 7]
def double_list(x):
    for i in range(0, `len`(n)):
        x[i] = x[i] * 2
    return x
# Don't forget to return your new list!

print double_list(n)

error message:

Oops, try again. double_list([0, 1]) resulted in an error: list index out of range

and in the console window:

[6, 10, 14]
None


#2

I think you have len listed as a string instead of a built in function. it says 'len' instead of len. The argument for double_list is x instead of n. In the print statement it is calling the n argument.

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

#3

try this I have commented in where the errors are

n = [3, 5, 7]
def double_list(x):
    #you had an error here you did `len(n)` you cannot have the backquotes
    #you have to use x as the argument for len() like this len(x)
    for i in range(0, len(x)):
        x[i] = x[i] * 2
    return x
# Don't forget to return your new list!

print (double_list(n))

#4

THANKYOU SO MUCH!!!!!! :sunglasses:

:grinning::triumph: