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


#1



Hello i'm trying learn this step : https://www.codecademy.com/courses/python-beginner-nzzVa/2/2?curriculum_id=4f89dab3d788890003000096

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)


#2

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


#3

Sorry i wrong, should be this:

def list_function(x):
    return x[1]

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

#4