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

Python · Theory

Boolean in Python

← All stacks

Theory

19/268

Boolean in Python

Boolean is True or False — capital T and F. Comparisons create them: 3 > 2 is True. if and while read booleans. Combine with and, or, not. Many values act truthy or falsy inside if: 0, "", [], None are false; most other values are true.

bool(x) converts using those rules. Writing true or false like JavaScript is a NameError. Viva: capital True/False, then one and/or example: True and False → False.

Boolean in Python — output — True, False, True. Empty string is falsy.

Exam tip

Capital T/F — not true/false.

Example

# Boolean
print(72 >= 40)
print(bool(""))
print(bool("Asha"))

Boolean in Python — output: True, False, True. Empty string is falsy.

Short notes

  • DefTrue / False.
  • Ruleand or not.
  • Traptrue/false lowercase.

Questions

1

Explain Boolean 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 Boolean?

Previous← Python String MethodsNextif-else 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.