Truthy vs Falsy Values in Python (original) (raw)

Last Updated : 27 May, 2026

In Python, every value has an inherent Boolean evaluation, it can either be considered True or False in a Boolean context. Values that evaluate to True are called truthy and values that evaluate to False are called falsy.

Python `

number = 7 if number: print("This will print because 7 is truthy.")

number = 0 if number: print("This will NOT print because 0 is falsy.")

`

Output

This will print because 7 is truthy.

**Explanation:

Truthy Values

These evaluate to True in a Boolean context:

if [1, 2]: print("Non-empty list is truthy")

if -4: print("-4 is truthy")

`

Output

Non-empty list is truthy -4 is truthy

Falsy Values

These evaluate to False in a Boolean context:

if not 0: print("0 is falsy")

if not []: print("Empty list is falsy")

`

Output

0 is falsy Empty list is falsy

**Example: This program demonstrates how truthy and falsy values can simplify conditions directly in the main code.

Python `

num1 = 7 num2 = 4

if num1 % 2: print(num1, "is odd") else: print(num1, "is even")

if num2 % 2: print(num2, "is odd") else: print(num2, "is even")

`

**Explanation:

Built-in bool() function

One can check if a value is either truthy or falsy with built-in bool() function. This function is used to return or convert a value to a Boolean value i.e., True or False, using the standard truth testing procedure.

Python `

print(bool(7))
print(bool(0))
print(bool([1,2,3])) print(bool([]))
print(bool(None))

`

Output

True False True False False

**Explanation:

**Syntax:

_bool(value)

**Parameter: value any Python object or literal to test for truthiness.