Python-Quizzes | Python Dictionary Quiz | Question 15

Question 15:Find the output of the following program:

filter_none

edit
close

play_arrow

link
brightness_4
code

temp = {'GFG' : 1
        'Facebook' : 2
        'Google' : 3
        
for (key, values) in temp.items(): 
    print(key, values, end = " "

chevron_right


(A) Google 3 GFG 1 Facebook 2
(B) Facebook 2 GFG 1 Google 3
(C) Facebook 2 Google 3 GFG 1
(D) Any of the above


Answer: (D)

Explanation: Dictionaries are unordered. So any key value pairs can be added at any location within a dictionary. Any of the output may come.

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.