Foundations-of-Programming-Python practice question 2 of 10
Which keyword moves a loop immediately to its subsequent iteration?
Full set: 60 questionsThe continue keyword is a control flow statement used inside loops. When the Python interpreter encounters continue, it immediately stops processing the current iteration of the loop and proceeds to the beginning of the next iteration. Any code within the loop's body that comes after the continue statement is skipped for that specific iteration. This is useful for bypassing certain elements in an iterable that do not meet a specific condition.
A. The pass keyword is a null operation; it acts as a placeholder where a statement is syntactically required but no code needs to be executed.
B. jump is not a valid keyword or control flow statement in the Python language.
D. advance is not a valid keyword or control flow statement in the Python language.
1. Python Software Foundation. (2023). The Python Tutorial, Section 4.4: break and continue Statements, and else Clauses on Loops. "The continue statement, also borrowed from C, continues with the next iteration of the loop." Retrieved from https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
2. Lutz, M. (2013). Learning Python (5th ed.). O'Reilly Media. Chapter 13, "The continue statement jumps to the top of the closest enclosing loop, skipping the rest of the loop body."
3. MIT OpenCourseWare. (2016). 6.0001 Introduction to Computer Science and Programming in Python, Fall 2016. Lecture 3 notes describe continue as a way to "end current iteration and jump to the next iteration."
Keep practicing
Take the free Foundations-of-Programming-Python practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Foundations-of-Programming-Python practice questions
- Question 1Which components are required in every Python for loop?
- Question 3A program needs to update all values in a list by adding 5 to each number. Which for loop…
- Question 4What must be consistent within a Python code block for the code to run without syntax err…
- Question 5Which Python data structure cannot be modified after creation?
