+ 1

Could you please explain me the concept of these type of Slicing Operator [::]?

a=[3,2,0,11,24,6,7] print (a[3::4])

18th May 2020, 6:06 PM
Bhanu Tripathi
Bhanu Tripathi - avatar
3 Answers
+ 4
It simply means that begin at index 3 then move till the end of the list in steps of 4.
18th May 2020, 6:16 PM
Avinesh
Avinesh - avatar
+ 4
Only to illustrate what Avinesh already mentioned: In this sample it only prints [11]. If the list will be a=[3,2,0,11,24,6,7,8,9,10], the result will be [11,8]
18th May 2020, 6:23 PM
Lothar
Lothar - avatar
+ 2
Yeah I got that...Thanks everyone
18th May 2020, 6:28 PM
Bhanu Tripathi
Bhanu Tripathi - avatar