Skip to content
Related Articles

Related Articles

Python-Quizzes | Python Dictionary Quiz | Question 21
  • Last Updated : 17 Sep, 2020

Question 21:Find the output of the following program:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


(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 :