What is the purpose of the 'break' statement in Python?
Correct answer
B. It terminates the loop and resumes execution after the loop
16 views
B. It terminates the loop and resumes execution after the loop
16 views
break terminates the loop immediately and resumes execution with the first statement after the loop. It is typically used once a searched-for item has been found.
continue is the statement that skips only the current iteration, and pass does nothing at all.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.