Concept

bool()

The bool() function returned True or False depending on the object. It always returns True for all objects, with the following exception: empty object like empty list/dictionary, 0, False, None.

print(bool(False)) #False print(bool(0)) #False print(bool(None)) #False print(bool([])) #False print(bool("abc")) #True print(bool(4)) #True print(bool([1,2,3])) #True

0

1

Updated 2021-03-21

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science

Related