Consider the following simple python code
>>> L = range(3) >>> L [0, 1, 2]
We can take slices of this array as follows:>
Left:
L[:1], L[1:] = L[-1:], L[:-1]
Right:
L[-1:], L[:-1] = L[:1], L[1:]