Modifying an element of a list in a function


#1



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)


#2

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?


#3

would i just use print n then???


#4

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


#5

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


#6

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


#7

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