Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python-Quizzes | Python Dictionary Quiz | Question 21

  • Last Updated : 17 Sep, 2020

Question 21:Find the output of the following program:




test = {1:'A', 2:'B', 3:'C'
del test[1
test[1] = 'D'
del test[2
print(len(test)) 

(A) Error
(B) 0
(C) 1
(D) 2


Answer: (D)

Explanation: After the key-value pair of 1:ā€™Aā€™ is deleted, the key-value pair of 1:ā€™Dā€™ is added.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!