Objective
With nested lists, a shallow copy shares the inner lists with the original; a deep copy duplicates them too.
Instructions
- Create
original = [[1, 2], [3, 4]], one copy withcopy.copyand another withcopy.deepcopy. - Then change
original[0][0]to99. - Show
Shallow: ...andDeep: ..., each on its own line, with the resulting list.
Shallow: [[99, 2], [3, 4]]
Deep: [[1, 2], [3, 4]]
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise