QuestionQ149

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

How can you remove every item from the d dictionary?

Expected output:

Question Image

Code:

Question Image

Explanation

Python’s dict.clear() method removes all key-value pairs from a dictionary in place, leaving the dictionary as {}.

Community Discussion

No comments yet. Be the first to start the discussion!