0

Here is my example:

def test(word):
    print(id(word))
    word.append('noun')
    word = ['something','new']
    print(id(word))

And it works as expected:

w = []
test(w)

produces:

140570192034056
140570192034568

and w

produces:

['noun']

But is it possible to assign w to new list value inside function? So that after function call w = ['something','new']

user1700890
  • 6,206
  • 15
  • 77
  • 160

0 Answers0