Using an element from a list in a function [Problem]


Hello i'm trying learn this step :

But always getting error:
Oops, try again. list_function([0, 5, 7, 0, 5]) returned 2 instead of 5

What is my problem?

def list_function(x):
    return n[1]

n = [0, 2, 7]
print list_function(n)


your function now only works for one list, what if we call the function with a different list:

print list_function([1,2,3])

your function should for multiply list, not just one. A function working for just one list, is not a good function


Sorry i wrong, should be this:

def list_function(x):
    return x[1]

n = [0, 2, 7]
print list_function(n)