Home >>Python Keywords >Python for Keyword

Python for Keyword

Python for Keyword

Python for Keyword is used to iterate through a sequence, like a list, tuple, etc and also helps you to create a loop.

Here is an example of Python for Keyword:

for z in range(1, 12):
 print(z)

Output:
1
2
3
4
5
6
7
8
9
10
11
Example 2:

colors = ["red", "blue", "yellow"]
for z in colors:
print(z)

Output:
red
blue

No Sidebar ads