Confused about Start, Stop, Step


#1

The range function wasn’t explained greatly when concerning start, stop, step.

How does this even work?

range(1, 6, 3) # =; [1, 4]


#2

1 < 6 followed by 1 being increased to 4 (step of 3)
4 < 6 followed by 4 being increased to 7 (step of 3)
7 < 6 is false, so range exit.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.