I have an error on array substitution.
way=[[0]*4]*2
arri=[1]*4
for i in range(0,2):
arri[i]=0
way[i]=arri
print(way)
I thought that
[[0, 1, 1, 1], [0, 0, 0, 0]]
[[0, 1, 1, 1], [0, 0, 1, 1]]
will be printed on the console, but actually:
[[0, 1, 1, 1], [0, 0, 0, 0]]
[[0, 0, 1, 1], [0, 0, 1, 1]]
This got printed on console.
When I fix way[i] to way[1],
[[0, 0, 0, 0], [0, 1, 1, 1]]
[[0, 0, 0, 0], [0, 0, 1, 1]]
This got printed.
What's the point I'm missing here?