What is For loop in Python?
- A for loop in python has the ability to iterate over items of any sequence (List, tuple, string) or any other iterable objects.
- Iterating over a sequence is called traversal.
Syntax:
for var in sequence:
body statements
- Here, var is a variable that is used to take the next values from the sequence on every iteration until the end of the sequence is reached.