Python-Quizzes | Python Dictionary Quiz | Question 14

Question 14:Find the output of the following program:

filter_none

edit
close

play_arrow

link
brightness_4
code

temp = dict() 
temp['key1'] = {'key1' : 44, 'key2' : 566
temp['key2'] = [1, 2, 3, 4
for (key, values) in temp.items(): 
    print(values, end = "") 

chevron_right


(A) Compilation error
(B) {‘key1’: 44, ‘key2’: 566}[1, 2, 3, 4]
(C) Runtime error
(D) None of the above


Answer: (B)

Explanation: A dictionary can hold any value such as an integer, string, list or even another dictionary holding key value pairs.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.