<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
What is the difference between deep copy and shallow copy in Python?
<|im_end|>
<|im_start|>assistant
A shallow copy of an object creates a new reference to the existing object, while a deep copy creates a new object with a different reference but with the same values. In a shallow copy, changes made to the copied object will be reflected in the original object, whereas with a deep copy, the changes are independent. For example, if a list is shallow copied, the copied list will share the same elements as the original list, while a deep copy will contain independent copies of the original list's elements.<|im_end|>
