0 votes
in Python by
What is the range() function and what are its parameters?

1 Answer

0 votes
by
The range() function is used to generate a list of numbers. Only integer numbers are allowed, and hence, parameters can be both negative and positive. The following parameters are

acceptable:

range(stop)

Where ‘stop’ is the no. of integers to generate, starting from 0. Example: range(5) == [0,1,2,3,4]

range([start], stop[, step])

Start: gives the starting no. of the sequence

Stop: specifies the upper limit for the sequence

Step: is the incrementing factor in the sequence
...