English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Explain the difference between del and clear( ) in dictionary with an example. - Computer Science

Advertisements
Advertisements

Question

Explain the difference between del and clear( ) in the dictionary with an example.

Distinguish Between

Solution

del() clear()
1. del() keyword is used to delete a particular element of a dictionary 1. The clear() function is used to delete all the elements in a dictionary
2. del() keyword can be used to remove the dictionary 2. The clear() function is used to delete all the elements in a dictionary not a dictionary structure.
3. Example: del Dict[‘MarkT] del Diet 3. Example: Dict.clear()
shaalaa.com
Introduction to List
  Is there an error in this question or solution?
Chapter 9: Lists, Tuples, Sets and Dictionary - Evaluation [Page 169]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 9 Lists, Tuples, Sets and Dictionary
Evaluation | Q 4. | Page 169
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×