I'm a newbie with Python, and I really don't understand why occurs this:
vector1 = [1,0,0,1]
left = vector1
print(str(left))
right = vector1
right[0] = 2
print(str(left))
print(str(right))
The output is:
[1, 0, 0, 1]
[2, 0, 0, 1]
[2, 0, 0, 1]
What I really want is:
[1, 0, 0, 1]
[1, 0, 0, 1]
[2, 0, 0, 1]
Why 'left' vector is updated if I fixed it before with the initial 'vector1' value?
I'm sure that this is a newbie question, but I'm used to code in MatLab and I'm getting confused...
Thanks in advance!