Modifying an element of a list in a function: wrong output



I am using following code, but my output is different than what I am expecting (it is adding 6 at the place of 3 in 2nd element of the list). But I am not getting any error and passing the exercise.
Can you suggest if my code is correct or not and what should be my output.

def list_function(x):
    return x

n = [3, 5, 7]


print list_function(n)


[3, 11, 7]


Hi @er.madhukar,

I suspect the main problem is when you did this:

Which resulted in you calling the function twice successively, giving you 5 + 3 + 3 :stuck_out_tongue:


Yes it worked.


You're welcome :slight_smile:


but still not sure, why it didn,t throw any error and let me pass this test :wink:


Probably because this exercise is mainly testing for the function itself, which you did get right :stuck_out_tongue: