two nested for loops python code example
Example 1: how to create a nested loop in python
for i in range(5):
for j in range(i):
# you can add many for loops or you can just write any code
Example 2: python combine nested for loops
from itertools import product
dice_sides = [1, 2, 3, 4, 5, 6]
coin_sides = ['Heads', 'Tails']
for die,coin in product(dice_sides, coin_sides):
print(die,coin)