Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

What is the primary effect of the continue statement when executed inside a loop in Python?
Options
A It immediately terminates the loop.
B It restarts the loop from the beginning.
C It skips the remaining statements in the current iteration and moves to the next iteration.
Correct Answer
D It causes an error if a condition is not met.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 97 states: 'The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop.'

Hint

Consider what 'continue' means in the context of a repetitive task – you want to move on, but not stop entirely.

Question Info