# Why doesn't 7/13 Work?

#1

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

The code should run and it does run the correct way, but it still prints an error message.

``````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)``````

#2

(0, len(n)): should be (0, len(x))

Apart from that your code is good

#3

Thank you! I appreciate the help!

#4

No worries man that's ok .

#5

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)

i tried this code

but
result is [12, 10, 14]
None
and
also error message

Oops, try again. double_list([0, 1]) returned [0, 1] instead of [0, 2]

pls help

#6

I don't know whether your indentation is correct or not, but try comparing your code with the one provided by this topic's creator.

``````n = [3, 5, 7]
def double_list(x):
for i in range(0, len(x)):
x[i] = x[i] * 2    # Here, you have written x[i]+2 instead of x[i]*2
return x

print double_list(n)``````

See if this helps.

#7

Thank you meason

i will try

may be it s due to indentation

#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.