Web Analytics

Python range() Function

Built-in Function Sequence

The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.

Syntax

range(start, stop, step)

Parameters

Parameter Description
start Optional. An integer specifying at which position to start. Default is 0
stop Required. An integer specifying at which position to stop (not included)
step Optional. An integer specifying the incrementation. Default is 1

Return Value

A sequence of numbers.

Example

Using the range() function in loops:

Output
Click Run to execute your code

Related Functions