Learn with Yasir

Share Your Feedback

Truthy and Falsy Values in Python – Conditional Logic Simplified


Understand how truthy and falsy values work in Python. Learn which values evaluate to True or False in conditional statements, with examples and practical tips for beginners.

In Python, some values are treated as True or False automatically when used in conditions.

Falsy values (evaluated as False):

  • None
  • False
  • 0 (any numeric zero)
  • "" (empty string)
  • [] (empty list)
  • {} (empty dict)
  • set() (empty set)

Everything else is truthy.

username = ""

if username:
    print("Welcome,", username)
else:
    print("Please enter a valid username")

Since username is an empty string (""), it’s falsy — the else block runs.


✅ Quick Practice Example

score = 75

if score:
    if score >= 90:
        print("Grade A")
    elif score >= 75:
        print("Grade B")
    else:
        print("Grade C")
else:
    print("No score provided")

🧠 Practice & Progress

Explore More Topics

📘 Learn Python

Tutorials, Roadmaps, Bootcamps & Visualization Projects

Python Fundamentals

Flow Control Statements


Python Functions


Fundamentals more ...




🧠 Python Advanced

Object-Oriented Programming in Python (OOP)

More...

🧠 Modules