TGViewer
Python Learning Python Learning @python_bds · 5.74K subscribers
Post #1195 699
🐍 Truthy vs Falsy in Python (Hidden Behavior)

In Python, not everything is just True or False 🤯
Some values behave like True… even when they’re not.


1️⃣ Falsy Values ❌

These are treated as False:

print(bool(0))
print(bool(""))
print(bool([]))


Output: False False False

👉 Empty or zero-like values → False


2️⃣ Truthy Values ✅

Everything else is considered True:

print(bool(1))
print(bool("Hello"))
print(bool([1, 2]))


Output: True True True

👉 Non-empty values → True


3️⃣ Why This Matters ⚡️

name = ""

if name:
print("Has value")
else:
print("Empty")


Output: Empty

👉 No need to write if name != ""


4️⃣ Common Mistake 🚫

if list == []:   # ❌


👉 Better way:

if not list:     # ✅



💡 Key Idea

Python doesn’t just check True/False
It checks if something is empty or not 🧠
  • ❤ 2
  • 👍 2
More from @python_bds
  1. Oct 8, 2026🐛 This Python Bug Looks Random, But It Isn't Look at this: functions = [] for i in range(…
  2. Oct 6, 2026🐍 Python Performance Optimization Python Performance Optimization: Make Your Code Faster…
  3. Oct 4, 2026Python Set Methods ✍️
  4. Oct 3, 2026Post #1310
  5. Oct 1, 2026🐍 Python Beginner Notes
  6. Sep 30, 2026🧠 return vs print() in Python These are not interchangeable. def add(a, b): print(a + b)…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →