Intermediate Python
Q48 / 101

What is the difference between deep copy and shallow copy?

Correct! Well done.

Incorrect.

The correct answer is B) Shallow copy copies only the top-level references; deep copy recursively copies all nested objects

B

Correct Answer

Shallow copy copies only the top-level references; deep copy recursively copies all nested objects

Explanation

copy.copy() creates a shallow copy; nested objects are still shared. copy.deepcopy() recursively creates independent copies of all nested objects.

Progress
48/101