PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

break vs continue in Python

← All stacks

Theory

27/268

break vs continue in Python

Both change loop flow, but not the same way. break leaves the loop. continue skips only this round. Print 1..5, skip 3 → continue: 1 2 4 5. Stop at 3 → break: 1 2. Same for-loop, two keywords, two printed lines. That pair is the whole topic.

Don’t mix the words in the viva. “continue exits the loop” is a fail. One sentence each, then the 1..5 mental example.

break vs continue in Python — output — 1 then 3. 2 skipped, 4 breaks, 5 never runs.

Exam tip

Same loop, two keywords, two outputs.

Example

# break vs continue
for i in range(1, 6):
    if i == 2:
        continue
    if i == 4:
        break
    print(i)

break vs continue in Python — output: 1 then 3. 2 skipped, 4 breaks, 5 never runs.

Short notes

  • DefBreak exits loop
  • RuleContinue skips round
  • RememberSame sample → two outputs

Questions

1

Explain break vs continue as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with break vs continue?

Previous← pass Statement in PythonNextfor Loop vs while Loop in Python →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.