Python range() function
Published February 16, 2022The range() function in Python returns the sequence that corresponds to the given pair of numbers. This function enables the user to create an integer sequence inside a specified range.
Based on that number of parameters the user passes to the function, the user may choose where the sequence of integers begins and ends and how much difference there is between one number and the next.
Syntax
range(stop) range(start, stop[, step]) |
where, range() accepts three parameters in total including:
Start: the number wherein the series of integers must be returned.
Stop: the number whereupon the series of integers must be returned.
Step: the integer number specifies the increase between every number in the series.
Example
for i in range(9): |
Output
0 1 2 3 4 5 6 7 8 |
Article Contributed By :
|
|
|
|
328 Views |