What we are dealing with is known as
slicing, which basically amounts to selecting a subsequence (slice) of a sequence (this can be any type of ordered sequence: tuple, list, string ...). The syntax is
seq[start:end]
(where either start or end may be omitted to signify defaults of beginning and end of sequence, respectively) or, with an optional step parameter,
seq[start:end:step]
so that the slice [start, end) starts at index start, ends at index end-1 (as usual, the end of the range is exclusive), and we move in increments of step (for instance, taking every second or every third element). A few examples with strings:
>>> "hello"[1:5]'ello'>>> "hello"[0:4]'hell'>>> "hello"[0:4:1]'hell'>>> "hello"[0:5:2]'hlo'>>> "hello"[::-1]'olleh'>>> "hello"[4::-1]'olleh'