Python Loop Control with break and continue
5 flashcards · 5 quiz questions · 5 match pairs · 5 fill-in sentences · English
Your progress is kept in this browser only.Sign up to save it
Summary
Loops repeat a block of code, but sometimes a program needs to stop a loop early or skip part of one iteration. Python’s break and continue statements provide these controls.
The break statement immediately exits the nearest enclosing for or while loop. Execution continues with the first statement after that loop. It is useful when a task is complete and further iterations are unnecessary, such as when a search finds the item it needs.
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.