+30 XP
Lesson 35

Nested Loops

Loops inside loops!

layers

Loops Inside Loops!

Nested loops are powerful for grids and patterns!

for row in range(3):
    for col in range(3):
        print(f"({row},{col})", end=" ")
    print()  # New line after each row
              

The inner loop runs completely for EACH iteration of the outer loop!