Python_Institute
PCEP-30-02 · Question #369
What is the output of the following snippet? dct = {} dct['1'] = (1, 2) dct['2'] = (2, 1) for x in dct.keys(): print(dct[x][1], end='')
The correct answer is D. 21. See the full explanation below for the reasoning.
Question
What is the output of the following snippet?
dct = {}
dct['1'] = (1, 2)
dct['2'] = (2, 1)
for x in dct.keys():
print(dct[x][1], end='')
Options
- A12
- B(2, 1)
- C(1, 2)
- D21
How the community answered
(22 responses)- A5% (1)
- B9% (2)
- C5% (1)
- D82% (18)
Community Discussion
No community discussion yet for this question.