Why is the output wrong



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!


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


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


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