There are 3 ways to call range
in Python:
range(INI, FIM, INC)
, this is, let's say, the basic form of range
in Python. The interval starts with INI
, being incremented by the INC
value at each iteration until it reaches or exceeds the value of FIM
; follows the following formula for i
increasing starting from zero:
range(INI, FIM)
, in this case, it is assumed that the increment value INC
is unitary;
range(FIM)
; in this case, it is assumed that the start INI
is 0 and that the INC
increment is unitary.
It should always be noted that the range is closed at the beginning (that is, includes INI
) and open at the end (ie it does not reach FIM
, for exactly the previous step).
Taking ownership of this knowledge, use the best semantics for your problem. In your particular case, I believe you want to use these values only for user interaction, not the internal logic of your program. If this is the case, the ideal is to do as the Anthony Gabriel response: only the view is treated to inform User-friendly indexes , making the use of the internal index more friendly to the code .
UPDATE
If the iteration does not favor the internal logic of the iteration at all, the answer from the Cigano Morrison Mendez is more and direct to the point.
I must admit that I'm biased to starting ties for zero, so out of pure prejudice I would lose this micro-optimization.