✅ Boolean Data Type

Last Updated: 13th August 2025


  • Boolean represents True or False values in Python.
  • It is used for logical decisions in programs.
  • Boolean values are actually a subtype of integers:
    • True1
    • False0

Hinglish Tip 🗣: Boolean ka kaam hai "yes" ya "no" type decisions lena — True matlab haan, False matlab nahi.


Syntax

variable_name = value # True or False

Example:

is_active = True
is_logged_in = False

print(is_active)     # Output: True
print(is_logged_in)  # Output: False

# Type Checking
print(type(is_active))     # Output: <class 'bool'>
print(type(is_logged_in))  # Output: <class 'bool'>

Some Important Points:

There are some True and False values in Python also Known as truthy and falsy values.:

ValueTruthy/Falsy
0Falsy
''Falsy
[]Falsy
NoneFalsy
FalseFalsy
Any number ≠ 0Truthy
Non-empty stringTruthy
Non-empty listTruthy

💡 Quick Practice

  • Create a boolean variable with value True and print its type.