What will be the output of the following Python code snippet?
>>> a={1:"A",2:"B",3:"C"}
>>> del a
>>> a={1:"A",2:"B",3:"C"}
>>> del aA. method del doesn't exist for the dictionary
B. del deletes the values in the dictionary
C. del deletes the entire dictionary
D. del deletes the keys in the dictionary
Answer: Option C
Related Questions on Dictionary in Python
Which of the following data types in Python is used to store key-value pairs?
A. Dictionary
B. List
C. Tuple
D. Set
A. setdefault()
B. addkey()
C. insert()
D. newkey()
What does the len() function do when applied to a dictionary?
A. Returns the number of key-value pairs in the dictionary
B. Returns the sum of all values
C. Returns the length of the longest key
D. Returns the length of the longest value
In Python, how can you get a list of all key-value pairs in a dictionary?
A. items()
B. get_items()
C. all_items()
D. list_items()

Join The Discussion