Modifying an element of a list in a function


I have been stuck on this one for a while and I cant seem to get it right can someone pls 
help explain why it is not working.  

Replace this line with your code. 
def list_function(x):
    x[0] = x[0] + 3
    return x
n = [3, 5, 7]
print Add to dictionary(n)


print Add to dictionary(n)

where does the Add to dictionary come from?

you have to call the function with function name

also read the instruction carefully. what does it want from you?


would i just use print n then???


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

is all you need to do


ohhhh I though I was suppose to add three to the list not add 3 to the 5.


I guess you need to drink more water while writing codes:relieved:


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