Python_Institute
PCEP-30-02 · Question #370
What will be the output of the following code snippet? a = [1, 2, 3, 4, 5, 6, 7, 8, 9] print(a[::2])
The correct answer is A. [1, 3, 5, 7, 9]. See the full explanation below for the reasoning.
Question
What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(a[::2])
Options
- A[1, 3, 5, 7, 9]
- B[8, 9]
- C[1, 2, 3]
- D[1, 2]
How the community answered
(41 responses)- A73% (30)
- B17% (7)
- C5% (2)
- D5% (2)
Community Discussion
No community discussion yet for this question.