Open In App

Python-Quizzes | Python Dictionary Quiz | Question 21

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

Article Tags :