Open In App

Python-Quizzes | Python Dictionary Quiz | Question 22

Like Article
Like
Save
Share
Report

Question 22:Find the output of the following program:




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


(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


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