0
What does the third argument in range do ? I'm confused
Third argument in range
5 Answers
+ 5
You can simply think it like:
start, stop, step = 0, 11, 2
index = start
while index != stop:
    print(index)
    index += step
>>> help(range)
Help on class range in module builtins:
class range(object)
 |  range(stop) -> range object
 |  range(start, stop[, step]) -> range object
 |
 |  Return an object that produces a sequence of integers from start (inclusive)
 |  to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.
 |  start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.
 |  These are exactly the valid indices for a list of 4 elements.
 |  When step is given, it specifies the increment (or decrement).
https://www.python.org/dev/peps/pep-0204/
+ 1
integer value which determines the increment between each integer in the sequence
//
 https://www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-range-function/amp/
0
So it determines the gap between the two numbers ?
0
Ashutosh Singh, yes
See my comment and open that link.
0
Ok thanks ! ^_^



