independent_copy(matrix) that takes a list of lists matrix (a 2D grid) and returns a fully independent copy: mutating any inner list of the copy must never affect matrix. A naive list(matrix) or slicing only copies the outer list, leaving inner lists shared — your solution must avoid that trap without using the copy module.independent_copy([[1, 2], [3, 4]])
[[1, 2], [3, 4]]
Same values, but every inner list is a brand-new object.
A shallow `matrix[:]` copies the outer list but the inner lists remain shared.
A list comprehension that copies each row individually solves it: `[row[:] for row in matrix]`.