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)- A6% (2)
- B78% (28)
- C11% (4)
- D6% (2)
Community Discussion
No community discussion yet for this question.