How would you remove all the items from the d dictionary?
Expected output:

Code:

How would you remove all the items from the d dictionary?
Expected output:
Code:
The correct option to remove all items from the dictionary d and result in an empty dictionary {} is: D. d.clear() Explanation: d.clear() removes all items from the dictionary without deleting the dictionary itself. Other options: d.del() and d.remove() are invalid as these methods do not exist for dictionaries. del d deletes the dictionary entirely, resulting in d no longer being defined. Example: d = {'A': 1, 'B': 2, 'C': 3} d.clear() print(d) # Output: {}
Only .clear is a valid method for dictionaries. D is correct
d is the correct answer
d.clear removes all