The range() is an in-built function in Python, which is used to repeat an action for a specific number of times.

Let us give you an example to demonstrate how the range() function works:

BY Best Interview Question ON 19 Jun 2020

Example

sum = 0
for i in range(1, 11):
    sum = sum + i
print("Sum of first 10 number :", sum)

Output:

Sum of first 10 number: 55