Modifying an element in list


#1

Here i have a problem again,

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

please help, thanks

Jay


#2

assuming you are at this exercise:

okay, so this:

x[1] = 3

will set the item at index 1 to a value of 3, not increase. How do you increase?

here:

x.append(x[1])

you modify an item in a list, so i don't see a point in appending?


#3

increase x by 3 and then return them


#4

Thanks Man............................................


#5

Thanks man.........................................


#6

issue resolved?


#7

Yes, resolved, Thanks for asking and thanks also for helping


#8