I have very simple example in Python:
class Solution(object):
def grid(self, m, n):
grid = [[0] * n] * m
grid[0][0] = 1
print(grid)
Solution().grid(5, 3)
When I run this code, it prints [[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]]
I'd expect it'd print [[1, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
I'm running Python 3.8.5
What am I missing here?