Python's range function is a built-in function that generates a list of numbers. This list is mostly used to iterate over using a for loop.
This function is used when you want to perform an action a predetermined number of times, where you may or may not care about the index, for instance, finding or calculating all even numbers between 0 and 100, where Python will list or print out all even numbers in that range, excluding 100, even though it is an even number. You can also use it to iterate over a list (or another iterable) while keeping track of the index.
The basic syntax of the range function is as follows:
range([start], stop, [step])
Here is a breakdown of what each parameter does:
start: This is the starting number of the sequence.
stop: This means generate numbers up to but not including this number.
step: This is the difference between each number in the sequence.
As a general rule, when a parameter is enclosed in square brackets [] in the function definition, it means...