Skip to content
Related Articles

Related Articles

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

Question 22:Find the output of the following program:

filter_none

edit
close

play_arrow

link
brightness_4
code

a ={} 
a['a']= 1
a['b']=[2, 3, 4
print(a) 

chevron_right


(A) {‘b’: [2], ‘a’: 1}
(B) {‘a’: 1, ‘b’: [2, 3, 4]}
(C) {‘b’: [2], ‘a’: [3]}
(D) Error


Answer: (B)

Explanation: Mutable members can be used as the values of the dictionary but they cannot be used as the keys of the dictionary

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :