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

Python · Theory

pass Statement in Python

← All stacks

Theory

26/268

pass Statement in Python

pass means do nothing. Python forbids an empty block after a colon, so pass keeps the syntax valid while you design. def todo(): pass. class Empty: pass. if ready: pass. Later you fill the body. It is not a delay and not a comment — it is a real statement that does zero work.

Viva: “why empty if needs pass”. Because indent + colon requires at least one statement. # comment alone is not a statement.

pass Statement in Python — output — Keep practising. pass lets the if-90 block exist without code yet.

Exam tip

Why empty if/def needs pass.

Example

# pass
marks = 72
if marks >= 90:
    pass  # A+ later
else:
    print("Keep practising")

pass Statement in Python — output: Keep practising. pass lets the if-90 block exist without code yet.

Short notes

  • DefDo-nothing placeholder.
  • RuleEmpty blocks after : need pass.
  • RememberStubs for def/class/if.

Questions

1

Explain pass Statement 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 pass Statement?

Previous← break in PythonNextbreak vs continue 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.