Problem Statement
Which statement about shallow copy versus deep copy is correct for a nested list?
Explanation
A shallow copy creates a new outer container but keeps references to the same inner objects. Editing an inner list through the copy also changes the original.
A deep copy recursively copies inner structures, so changes in the copy do not leak back. Pick deep copy when you need isolation.
Code Solution
SolutionRead Only
import copy orig=[[1],[2]] sh=copy.copy(orig) dp=copy.deepcopy(orig) sh[0][0]=9 # orig also changes # dp edits do not affect orig
