Nested Loops: Iteration, Control, and Pattern Generation
5 flashcards · 5 quiz questions · 5 match pairs · 4 fill-in sentences · English
Your progress is kept in this browser only.Sign up to save it
Summary
Nested loops let a program repeat one process inside another. They are useful when working with combinations of values, such as hours and minutes, names within course rosters, or rows of a pattern.
A nested loop is a loop placed inside the body of another loop. The loop surrounding it is the outer loop; the loop inside it is the inner loop.
For each iteration of the outer loop, the inner loop runs through its complete set of iterations. If the outer loop repeats 3 times and the inner loop runs 4 times per outer iteration, the inner loop's body runs times in total.
All flashcards
Quiz questions
Based on Introduction to Python Programming by Udayan Das, Aubrey Lawson, Chris Mayfield, Narges Norouzi (OpenStax), licensed CC BY 4.0. Adapted into a summary, flashcards and quizzes.