Range Attributes

range.step

Stored nonzero stride between successive values. It defaults to one, and negative strides produce descending values when the bounds permit. Zero is rejected by the constructor. The step is not the number of elements. Access without parentheses; the attribute is read-only.

Formal Syntax & Structure

python syntaxpython
value.step

Return Value

int

Stored integer bound or stride.

Working Example

Example Snippetpython
print(range(5).step)r = range(9, 0, -3)print(r.step, list(r))
Python Reference