for - To create a for loop

For loops are used to iterate over a collection or range.

Example of a range:

Python
for x in range(2, 6):
    print(x)

Output

2
3
4
5

Characters in a string:

Python
for c in 'Hello':
    print(c)

Output

H
e
l
l
o

Items in an array:

Python
for c in 'Hello':
    print(c)

Output

Country
State
State
Town