Report Bug

Qus

What does the following slice return?

s = [0,1,2,3,4,5]
print(s[1:5:2])
Qus

निम्न slice का result क्या होगा?

s = [0,1,2,3,4,5]
print(s[1:5:2])


A. [1, 3]
B. [2, 4]
C. [1, 2, 3, 4]
D. [0, 2, 4]


Solution
A. [1, 3]



Explanation
<p><span style="font-size: 14px;">It starts at index 1, stops before index 5 and moves with step 2.</span></p><p><span style="font-size: 14px;"><br></span></p><p><span style="font-size: 14px;"><br></span></p><p><span style="font-size: 14px;">Slice index 1 से शुरू होती है, index 5 से पहले रुकती है और step 2 लेती है; इसलिए [1,3] मिलता है।</span></p>
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad