For loops are used for sequential traversal. For example: traversing a list or string or array etc.
The for loop in Python is used to iterate over a sequence (list, tuple, string) or other iterable objects. Iterating over a sequence is called traversal.
Let’s quickly work on few examples:
Here the variable i is iterated 5 times as the Range (5) is the expression/condition and printing the Hello Python is the Body of the loop.
The range in python is considered as from Index 0 to Index 4
Here we can clearly see the List of range starts from 0 to 4.
Let’s look at another example: