nerdexam
Python_Institute

PCEP-30-02 · Question #365

What is the expected output of the following code? x = [0, 1, 2] x.insert(0, 1) del x[1] print(sum(x))

The correct answer is B. 4. See the full explanation below for the reasoning.

Question

What is the expected output of the following code? x = [0, 1, 2] x.insert(0, 1) del x[1] print(sum(x))

Options

  • A2
  • B4
  • C5
  • D3

How the community answered

(36 responses)
  • A
    6% (2)
  • B
    78% (28)
  • C
    11% (4)
  • D
    6% (2)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice