A series of numbers.

Arguments

  • from - inclusive
  • to - exclusive
  • interval - defaults to 1

Iterator

Returns as type range.

range(10)
# => range(0, 10)

Evaluated

list(range(10))
# => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Increment by value

range(1, 10, 2)

Descending

range(10, 1, -1)

Check

Easy testing in the shell:

python -c 'print(list(range(1, 10, 2)))'
# => [1, 3, 5, 7, 9]