What is the purpose of range() function? Give one example.
Answers
Answered by
37
Answer:
The range() function is used to generate a sequence of numbers over time. At its simplest, it accepts an integer and returns a range object (a type of iterable). In Python 2, the range() returns a list which is not very efficient to handle large data. (optional) Starting point of the sequence
Explanation:
hope it helps u..
Answered by
8
Answer:
One of the most common uses of the range() function is for iterating over a series of values in a for loop. This is particularly useful if you want to access each of the values in a list or array, or, for example, only every other value. In this example, the range() function is generating a sequence from 0 to 4 .
Similar questions
Math,
5 months ago
English,
5 months ago
Political Science,
5 months ago
Social Sciences,
1 year ago
Math,
1 year ago