Loading section...
Copying Dictionaries
When you assign a dictionary to a new variable, you don't create a copy. Both variables point to the same dictionary. This is critical to understand: Shallow Copy with .copy() Fill in the blanks to take a snapshot of a dictionary, then modify the original. Think about what each operation returns. Understanding reference semantics vs copy semantics is crucial for avoiding bugs when passing dictionaries to functions. Functions receive a reference by default, so any mutation inside the function is visible to the caller. Shallow copy is sufficient for flat dictionaries - those where values are simple types like strings and numbers. Deep copy is only needed when values themselves are mutable containers like lists or nested dicts. The pattern of copying before passing to a function that might mu