nerdexam
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)
  • A
    75% (50)
  • B
    3% (2)
  • C
    15% (10)
  • D
    7% (5)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice