I can t understand why 'matriz' is being modified, how am i supposed to modify 'matriznew' without affecting the original one?
matriz = [[1.0, 7.0, 0, 5.0],
[1.125, 1.0, 0.25, 0.875],
[0, 0.6, 1.0, 0.2]]
matriznew = matriz
for line in range(len(matriznew)):
matriznew[line].pop(-1)
print(matriznew)
print(matriz)
OUTPUT:
[[1.0, 7.0, 0], [1.125, 1.0, 0.25], [0, 0.6, 1.0]]
[[1.0, 7.0, 0], [1.125, 1.0, 0.25], [0, 0.6, 1.0]]