slice equivalent in python code example
Example 1: is : and :: the same in python slice
a[-1] # last item in the array
a[-2:] # last two items in the array
a[:-2] # everything except the last two items
Example 2: python list slice sybtax
# [start:stop:step]
# for example ...
l = [1, 2, 3, 4, 5]
l[1:4] # elements from 1 (inclusive) to 4 (exclusive)
l[2:5:2] # elements from 2 (inclusive) to 5 (exclusive) going up by 2