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():

Show Output

Show Output

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

Show Output

Show Output

Comment your suggestion or doubts below.

Leave a Reply

Close Menu