I have a matrix M with float numbers. I want to round said numbers to 3 decimals and update the matrix. However, M doesn't change. Why is M not updating?
M= [[1.0, 0.6666666666666666, 0.0, 0.5098039215686274], [-0.0, -0.0, 1.0, 0.4117647058823529]]
for arr in M:
for number in arr:
number = round(number, 3)
print(M) #[[1.0, 0.6666666666666666, 0.0, 0.5098039215686274], [-0.0, -0.0, 1.0, 0.4117647058823529]]