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>
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad