Modifying an element of a list in a function


#1



Replace this line with your code.

can anyone help?


#2

@noidea1: You're just returning the element you've changed, i , other than the list you passed as an argument, x.

In order for you to change the value in that position, maintain it and return it, you should've done the following:

x[1] = x[1] + 3 #changing the value in that position
return x # returning your list with that valued altered

#3

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