I try to replace the value of the first element with the value of the second element on a numpy array and a list whose elements are exactly the same, but the result I get is different.
1) test on a numpy array:
test=np.array([2,1])
left=test[:1]
right=test[1:]
test[0]=right[0]
print('left=:',left)
I get: left=: [1]
2) test on a python list:
test=[2,1]
left=test[:1]
right=test[1:]
test[0]=right[0]
print('left=:',left)
I get: left=: [2]
Could anyone explain why the results are different? Thanks in advance.