BAD INSTRUCTIONS ! in Passing a range into a function

#1

Passing a range into a function

The instructions state :
On line 6, replace the ____ with a range() that returns a list containing [0, 1, 2].

IF the RETURNED LIST is [0, 1, 2] then the ORIGINAL LIST should be [ 0, 0.5, 1]

#2

but `range()` is a function call to a built in function which returns a list, so range should return `[0,1,2]`

#3

It still gives the impression that THE FINAL RETURNED LIST is [0,1,2] from an input at the "____"

I have done similar in my life, I wrote a sentence that made sense to me but was DOUBLE meaning to others..

Thanks
BEST

#4

I agree, I was thinking they'd expect I put something in there for a return list of [0,1,2]

#5

i dont get it...can someone explain the function of "step" here?

#6

step is how much the loop increases/decreases, you can always can check the documentation:

https://docs.python.org/2/library/functions.html#range

#7

def my_function(x):
for i in range(0, len(x)):
print x[i]
x[i] = x[i]
return x

print my_function(range(3))

this code intented correcly return [0, 1, 2]
but is necesary erase (*2) in code and put (range (3))
but this is not the ejercice

#8

#9

this version is interesting .

def my_function(x):
for i in range(0, len(x)):
print x[i]
x[i] = x[i]
return x

print my_function(range(1000))

#10

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