What does the following slice return?
s = [0,1,2,3,4,5] print(s[1:5:2])
निम्न slice का result क्या होगा?
A. [1, 3]
B. [2, 4]
C. [1, 2, 3, 4]
D. [0, 2, 4]
It starts at index 1, stops before index 5 and moves with step 2.
Slice index 1 से शुरू होती है, index 5 से पहले रुकती है और step 2 लेती है; इसलिए [1,3] मिलता है।