Bird
0
0

Why does the expression bool([]) == bool(0) evaluate to True in Python?

hard📝 Conceptual Q10 of 15
Python - Data Types as Values
Why does the expression bool([]) == bool(0) evaluate to True in Python?
ABecause empty list and zero are equal objects
BBecause both [] and 0 are falsy values
CBecause bool() converts any object to True
DBecause bool() returns None for empty containers
Step-by-Step Solution
Solution:
  1. Step 1: Understand bool conversion

    bool() returns False for falsy values like empty list and zero.
  2. Step 2: Compare bool([]) and bool(0)

    Both convert to False, so their equality is True.
  3. Final Answer:

    Both are falsy, so bool() returns False for both -> Option B
  4. Quick Check:

    Falsy values convert to False [OK]
Quick Trick: Falsy values convert to False with bool() [OK]
Common Mistakes:
MISTAKES
  • Thinking empty list equals zero
  • Assuming bool() returns True always
  • Believing bool() returns None for empty containers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes