I have created a 2D array in Python as:
dp = [[0] * 3] * 4
When I modify a certain element in it, each column of the array gets modified:
dp[1][2] = 10
print(dp)
> [[0,0,10], [0,0,10], [0,0,10], [0,0,10]]
Why is that the case and how can I update only the correct element of the array?