1. Home
  2. Data Science
  3. Python
  4. What is the purpose of the 'break' statement in Python?

Added 10 Feb 2024

What is the purpose of the 'break' statement in Python?

  1. It skips the current loop iteration
  2. It terminates the loop and resumes execution after the loop Correct answer
  3. It is used to define a new variable
  4. It raises an exception

Correct answer

B. It terminates the loop and resumes execution after the loop

16 views

MCQSEXAM

Explanation

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.

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs