What is the output of `bool([] or {} or 0 or ‘hello’)`?

Python Professional Hard

Python Professional — Hard

What is the output of `bool([] or {} or 0 or ‘hello’)`?

Key points

  • The `or` operator stops at the first truthy value
  • An empty list, empty dictionary, and 0 are considered falsy
  • 'hello' is a non-empty string, making the entire expression True

Ready to go further?

Related questions