Chapter 26 Nested Loop Control Structures
26.1 What is a Nested Loop?
A nested loop is a loop within another loop or, in other words, an inner loop within an outer one.
The outer loop controls the number of complete iterations of the inner loop. This means that the first iteration of the outer loop triggers the inner loop to start iterating until completion. Then, the second iteration of the outer loop triggers the inner loop to start iterating until completion again. This process repeats until the outer loop has performed all of its iterations.
Take the following Python program, for example.
Get Python and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.