VFlash: Fast, Accurate Visual Planning via Flash Primitive Decoding
u_Unrolled
Easy10 XPlistsbugs

What does [[0] * 3] * 3 really create?

After this code, how many cells of grid hold the value 1?

grid = [[0] * 3] * 3
grid[0][0] = 1
Stuck? Show the solution

Answer: 3

* 3 repeats the reference to one inner list, so all three rows are the same list and the 1 appears in each row. Build rows with [[0] * 3 for _ in range(3)].

Learn the idea behind itLists and Tuples — Sequences, Copies and What They Cost