Computer Science, asked by rahul43107, 4 months ago

explain the difference between del and clear in dictionary with an example​

Answers

Answered by sonalipoojri77
7

Answer:

clear() removes every key, so basically their behavior is the same. On the memory issue, in Python when you "delete" you are basically removing a reference to an object. ... clear() will free the memory of the hashset used in the dict, while removing the key will not.

Similar questions