Passing a range into a function


#1

My code is not behaving incorrectly I just do not understand what's happening. It is correct and prints out [0, 2, 4] .


def my_function(x):
    for i in range(0, len(x)):
        x[i] = x[i] * 2
    return x
    
 
print my_function([0, 1, 2]) # Add your range between the parentheses!


#2

the exercise validates range() is present and outputting the right list, you don't use range()


#3

Oh, okay it just made it sound like it was looking for you to use the range function twice but that makes sense. Thank you


#4

yea, the exercise even gave a hint:

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

that the function range should also be the function call argument

issue resolved?


#5

Yes thank you very much


#6