Debug a 2D grid where changing one cell changes a whole column
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.grid = [[0] * 3] * 3
grid[0][0] = 1
print(grid)
buckets = [[]] * 4
buckets[2].append("x")
print(buckets)
Why are the outputs not what the author expected, and how should the code be written? What is the NumPy equivalent trap?