Using an element from a list in a function


def list_function(x):
    return x[0]
n = [3, 5, 7]
print list_function(n)

returns the following error: Oops, try again. list_function([4, 6]) returned 4 instead of 6
However the output is correct. Thanks in advance for your help.


Change line 2 so that list_function returns only the item stored in index one of x

you return the item at index 0, not at index 1.


Many thanks. I mixed up item one and index one,