Nested Loop

say it: “NES-tid loop” /ˈnɛstɪd lup/

A loop inside another loop.

What is a nested loop?

A nested loop is a loop inside another loop. The inner loop runs all the way through for every pass of the outer one.

for row in ["A", "B"]:
    for seat in [1, 2]:
        print(f"{row}{seat}")   # A1 A2 B1 B2

Level: Apprentice · More Python terms at this level

Updated

In other subjects