English

Assuming that D1 is a dictionary in Python. Write a single statement to delete all the elements from D1. - Computer Science (Python)

Advertisements
Advertisements

Question

Assuming that D1 is a dictionary in Python.

Write a single statement to delete all the elements from D1.

Very Short Answer
Advertisements

Solution

D1.clear()

This statement removes all items (key-value pairs) from the dictionary, leaving it empty.

shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×