Function modifies list
问题 def make_Ab(A,b): n = len(A) Ab = list(A) for index in range(0,n): Ab[index].append(b[index][0]) print(A) return Ab.copy() A = [[0.0, 1.0, 1.0, 2.0], [1.0, 3.0, 1.0, 5.0], [2.0, 0.0, 2.0, 4.0]] b = [[1],[2],[3]] print(A) [[0.0, 1.0, 1.0, 2.0], [1.0, 3.0, 1.0, 5.0], [2.0, 0.0, 2.0, 4.0]] Ab = make_Ab(A,b) print(A) [[0.0, 1.0, 1.0, 2.0, 1], [1.0, 3.0, 1.0, 5.0, 2], [2.0, 0.0, 2.0, 4.0, 3]] I don't get why does my function modify my original list. I didn't specify A as global in function (I've