Why does a function affects the input to the function?

前端 未结 0 1382
死守一世寂寞
死守一世寂寞 2021-01-16 05:26

I define the following function, that takes in a list of numbers and flips its second position

def flip(x):
  y = x
  y[1] = -y[1]
  return y

相关标签:
回答
  • 消灭零回复
提交回复
热议问题