range() in Python allows us to create a sequence of numbers from a starting point up to an ending point.

Syntax:

Let’s see some examples using range():

Output

Output

Note: The last element is always excluded in range().

Output

Output

Comment your suggestion or doubts below.

Leave a Reply

Close Menu