for range(stop), the last element is the largest 'i' less than stop (source: https://docs.python.org/2/library/functions.html#range)