Python-Quizzes | Python Dictionary Quiz | Question 20
Question 20:Find the output of the following program:
a = {} a[1] = 1a['1'] = 2a[1]= a[1]+1count = 0for i in a: count += a[i] print(count) |
(A) 2
(B) 4
(C) 1
(D) Error
Answer: (B)
Explanation: The above piece of code basically finds the sum of the values of keys.
Quiz of this Question



