I have a 'matrix', then choose one row as the 'vector', and then change one element in this vector. However, the element in the 'matrix' also changes. Why?
Matrix = [[1,2,3],[4,5,6],[7,8,9]]
Vector = Matrix[1]
print('Vector', Vector)
print('Matrix', Matrix)
Vector[1] = float(99)
print('Vector', Vector)
print('Matrix', Matrix)
Output:
Vector [4, 5, 6]
Matrix [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Vector [4, 99.0, 6]
Matrix [[1, 2, 3], [4, 99.0, 6], [7, 8, 9]]