14. Passing a range into a function


#1




Traceback (most recent call last):
File "python", line 6, in
TypeError: range() integer end argument expected, got list.

Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: range() integer end argument expected, got list.


I don't get it...


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([0,1,2]))


#2

NVM... I got it.
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!


#3

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