Python_Institute
PCEP-30-02 · Question #372
What is the output of the following snippet? dictionary = {'one': 'two', 'three': 'one', 'two': 'three'} v = dictionary['one'] for k in range(len(dictionary)): v = dictionary[v] print(v)
The correct answer is A. two. See the full explanation below for the reasoning.
Question
What is the output of the following snippet?
dictionary = {'one': 'two', 'three': 'one', 'two': 'three'}
v = dictionary['one']
for k in range(len(dictionary)):
v = dictionary[v]
print(v)
Options
- Atwo
- Bone
- C('one', 'two', 'three')
- Dthree
How the community answered
(67 responses)- A75% (50)
- B3% (2)
- C15% (10)
- D7% (5)
Community Discussion
No community discussion yet for this question.