All lessons

Nested Loops

A loop inside a loop — the inner block runs for every outer pass

Change the outer (rows) and inner (stars per row) counts and watch the grid.

outer (rows)
3
inner (per row)
4
for i in range(3):
    for j in range(4):
        print("⭐")

Inner line runs: 12 times

3 × 4 = 12