Slices in Python

Basics

l[start:end] # from start to end - 1
l[start:]    # from start to the end of the array
l[:end]      # from the beginning of the array to end - 1
l[:]         # this is how to copy an array

Step value

l[start:end:step] # from start to the last multiple of step < end, increasing by step
l[::n]            # every nth item
l[::-n]           # every nth item in reverse

Negative index

l[-1]    # last item in the array
l[-n:]   # last n items in the array
l[:-n]   # all except the last n items