I am trying to copy a vector several times and then change one of its elements:
from copy import deepcopy
v = [0.5,1.0,2.0]
m = 3 * [deepcopy(v)]
# m = [[0.5,1.0,2.0],[0.5,1.0,2.0],[0.5,1.0,2.0]]
m [0][0] = "Python"
# m = [["Python",1.0,2.0],["Python",1.0,2.0],["Python",1.0,2.0]]
as you can see instead of just changing the 0 element form the 0 array, it is changing all the 0 elements. What am I doing wrong?
Thanks!