nerdexam
Python_Institute

PCEP-30-02 · Question #300

What is the expected output of the following code? data = [[42, 17, 23, 13], [11, 9, 3, 7]] res = data[0][0] for da in data: for d in da: if res > d: res = d print(res)

The correct answer is A. 3. See the full explanation below for the reasoning.

Question

What is the expected output of the following code? data = [[42, 17, 23, 13], [11, 9, 3, 7]] res = data[0][0] for da in data: for d in da: if res > d: res = d print(res)

Options

  • A3
  • B13
  • CThe code is erroneous.
  • D42

How the community answered

(33 responses)
  • A
    82% (27)
  • B
    12% (4)
  • C
    3% (1)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice