# basics loops

Loops Inside Loops

You can put a loop inside another loop. The inner loop runs all the way through for every single pass of the outer one:

for row in range(2):
    for col in range(3):
        print(row, col)

prints:

0 0
0 1
0 2
1 0
1 1
1 2

Your turn: read rows and cols. For every row from 0 to rows - 1, and every col from 0 to cols - 1, print row and col separated by a space (print(row, col)).

💡 need a hint?

pyb-loop-nested.py🔒 given lines are locked — write your code in between
loading...