Modifying an element of a list in a function


This is my code and I really have no clue what to do:

def list_function(x):
n[1] = n[1] + 3
return n[1]

n = [3, 5, 7]
print list_function(n)

And this is the error message it gives:

Oops, try again.
list_function([6, 5]) returned 11 instead of [6, 8]


@papayabubble Hey,
Remember you're in a function and the parameter "x" has to be included within the local scope. Not n, unless you're calling the function, from which you did.
Hope this helps!


def list_function(x):
tab x[1] = x[1] + 3
tab rerun x


Thanks I made it through!


This code work for me. Any stuck on this challenge.

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

as it is.


That worked for me as well