PCEP 30 02 PCEP Certified Entry Level Python Programmer · Free Practice Question Easy
Question 17
What is the output of the following code snippet?
- d1 = {'Age': 27, 'Name': 'Holding'}
- d2 = {'Name': 'Holding', 'Age': 27}
- print(d1 == d2)
-
A
True -
B
False -
C
0 -
D
1
Reveal correct answer
Correct answer: A
Explanation
d1 and d2 are dictionaries and both are different dictionaries but the content is the same. Hence, the == operator will be True irrespective of the order of the elements because the order does not matter in the dictionary.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
