Advertisements
Advertisements
प्रश्न
What is the purpose of the range() function? Give one example.
टीपा लिहा
Advertisements
उत्तर
The range() function is a built-in function of Python. It is used to create a list containing a sequence of integers from the given start value to the stop value (excluding the stop value). This is often used in for loop for generating the sequence of numbers.
Example:
for num in range(0,5):
print (num)
OUTPUT:
0
1
2
3
4shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
