The range() function returns a sequence of numbers starting from 0 (by default) if the initial limit is not specified and it increments by 1 (by default) until a final limit is reached.
The range() function is used with a loop to specify the range (how many times) the code block will be executed. Let us see with an example.
For i in range(5) >>>----That means---->>> range(5) = Start=0, Stop=5, Step=1
Get started:
1st iteration - when i = 0 to execute code block
2nd iteration - when i = 1 to execute code block
3rd iteration - when i = 2 to execute code block
4th iteration - when i = 3 to execute code block
5th iteration - when i = 4 to execute code block
End
Print su