Python Code Example: double nested for-loop

Here the product of the individual loop elements is output in a double nested loop.

for i in range(3, 5):
    for j in range(1, 10):
        for k in range(1, 5):
            print(i * j * k, end=" ")
        print()
    print()
Output
3 6 9 12 
6 12 18 24 
9 18 27 36 
12 24 36 48 
15 30 45 60 
18 36 54 72 
21 42 63 84 
24 48 72 96 
27 54 81 108 

4 8 12 16 
8 16 24 32 
12 24 36 48 
16 32 48 64 
20 40 60 80 
24 48 72 96 
28 56 84 112 
32 64 96 128 
36 72 108 144