+ 3
It is called Slicing Notation used for Lists/Array.
The syntax is:
a[start:end:step]
So you can do:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
a[1 : 8 : 2]
Output - [2, 4, 6, 8]
- number before first colon means the starting index of the slice. The default value is Zero.
- number after the last colon shows slicing increment.
- middle number shows the ending index of slice.