in Python by
What Is A Built-In Function That Python Uses To Iterate Over A Number Sequence?

▼ Show 1 Answer

0 votes
Range() generates a list of numbers, which is used to iterate over for loops.

for i in range(5):


The range() function accompanies two sets of parameters.


stop: It is the no. of integers to generate and starts from zero. eg. range(3) == [0, 1, 2].

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

Start: It is the starting no. of the sequence.

Stop: It specifies the upper limit of the sequence.

Step: It is the incrementing factor for generating the sequence.

Points to note:

Only integer arguments are allowed.

Parameters can be positive or negative.

The range() function in Python starts from the zeroth index.
Learn More with Madanswer

Related questions

0 votes
asked May 17, 2020 in Python by sharadyadav1986