I have code like this:
import numpy as np
area = np.zeros([2,2])
f = area
print(area)
f[0][0]=1
print(area)
print(f)
Which produces the following arrays
[[0. 0.]
[0. 0.]]
[[1. 0.]
[0. 0.]]
[[1. 0.]
[0. 0.]]
How do I get it so that the area
array is not 'linked' to the f
array i.e. after the calculation the f
array changes but the area
array does not?
x = y
says "let the namex
now refer to the object currently being referenced by the namey
", it doesn't say, "copy the object being referred to byy
and assign it to the namex
"