I've got matrix = [[1,2,3],[4,5,6],[7,8,9]]
and matrix2=matrix
. Now I want to delete first row from matrix2 i.e., matrix2.remove(matrix[0])
.
But I am getting this
>>> matrix2.remove(matrix2[0])
>>> matrix2
[[4, 5, 6], [7, 8, 9]]
>>> matrix
[[4, 5, 6], [7, 8, 9]]
First row of matrix
is also removed. Can anyone explain this? And how to remove first row from matrix2
without altering matrix