Bird
0
0

What is the Boolean value of the expression bool([]) in Python?

easy📝 Conceptual Q2 of 15
Python - Data Types as Values
What is the Boolean value of the expression bool([]) in Python?
ANone
BTrue
CFalse
DError
Step-by-Step Solution
Solution:
  1. Step 1: Understand Boolean conversion of empty collections

    Empty lists are considered False in Boolean context in Python.
  2. Step 2: Evaluate bool([])

    Since the list is empty, bool([]) returns False.
  3. Final Answer:

    False -> Option C
  4. Quick Check:

    Empty list Boolean = False [OK]
Quick Trick: Empty collections are False, non-empty are True [OK]
Common Mistakes:
MISTAKES
  • Assuming empty list is True
  • Confusing None with False
  • Expecting an error for empty list

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes