Python_Institute
PCEP-30-02 · Question #347
PCEP-30-02 Question #347: Real Exam Question with Answer & Explanation
The correct answer is D. 6. See the full explanation below for the reasoning.
Question
What is the expected output of the following code?
collection = []
collection.append(1)
collection.insert(0, 2)
duplicate = collection
duplicate.append(3)
print(len(collection) + len(duplicate))
Options
- AThe code raises an exception and outputs nothing.
- B4
- C5
- D6
Community Discussion
No community discussion yet for this question.