Question #716

Which one is not a correct way of creating a copy of a dictionary?

A dictionary can be copied using the built-in methods dict() or copy() . dict1.items() returns a list of tuples containing the key-value pairs of dict1 . Those are also a valid argument to pass to dict() to create a copy of dict1 . A dictionary cannot be copied directly with dict2 = dict1 as dict2 will then only be a reference to dict1 and changes made in dict1 will automatically also be made in dict2 . (

Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵