QuestenaUn entraînement qui indique quoi revoir ensuite
Question 48

After `copy = data.copy()` for a dictionary with a nested list value, which statements are true? Select all that apply.

  1. The outer dictionaries are distinct objects.Bonne réponse
  2. Every nested object is recursively duplicated.
  3. A nested list value can still be shared.Bonne réponse
  4. `copy` is merely another name for the same outer dictionary.

Explication

The call constructs a separate outer dictionary, but its values are copied as references, so a nested list remains shared. Calling this a deep copy incorrectly assumes recursive duplication, while calling it a complete alias ignores the new outer mapping.

Continuer avec ce test

Commencer l’entraînement
Question 48: After `copy = data.copy()` for a dictionary with a nested… · Python Fundamentals · Questena