Python For Loop

Learn how to repeat tasks using Python for loops.

Python For Loop

The for loop is used to iterate through sequences.

Basic For Loop

for i in range(5):
    print(i)
	

Loop Through List

fruits = ["Apple", "Banana", "Mango"]

for fruit in fruits:
    print(fruit)

Nested Loop

for i in range(3):
    for j in range(2):
        print(i, j)
		

Loop with String

for letter in "Python":
    print(letter)