I am wondering if someone can explain why Python modifies the original variable after assigning it to another variable and then passing the second variable the function call: Consider the following example code: Assume A is the original variable:
A=np.array(([1,20,30,40,10,5,60]))
B=A
B.sort()
print(A)
print(B)
The output for both is the same:
[ 1 5 10 20 30 40 60]
[ 1 5 10 20 30 40 60]
A is the original variable and I assigned it the B and then I sort B, then why both A and B are sorted ? what if I want to sort B only and compare it to A