Why is the output wrong


#1



https://www.codecademy.com/en/courses/python-beginner-nzzVa/3/3?curriculum_id=4f89dab3d788890003000096


i succeded in the lesson but my target was to get a [0 , 1 ,2] output but i got [0,2,4]...


Replace this line with your code. 
def my_function(x):
    for i in range(0, len(x)):
        x[i] = x[i] * 2
    return x

print my_function(range(3)) # Add your range between the parentheses!


#2

doesn't metter , just understood that the loop make it bigger


#3

This line is the reason you get [0, 2, 4]. :slight_smile:


#4

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