For loop is a python loop which repeats a group of statement a specified number of times. The for loop of python is designed to process the items of any sequence, such as a list or a string, one by one.
The for loop provides a syntax where the following information is provided:-
- Boolean condition
- The initial value of the counting variable
- Increment of counting variable.
syntax:-
for variable in sequence: statements
e.g.,
n = 10 for i in range(0, n): print(i)
Output- 0 1 2 3 4 5 6 7 8 9