Open In App

Python-Quizzes | Python Dictionary Quiz | Question 21

Like Article
Like
Save
Share
Report

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


Last Updated : 17 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads