python boolean operator code example
Example 1: python boolean operators
>>>
>>> not True
False
>>> not False
True
>>>
>>> True and True
True
>>> False and True
False
>>> False and False
False
>>>
>>> True or True
True
>>> False or True
True
>>> False or False
False
Example 2: and bool python
i = 5
ii = 10
if i == 5 and ii == 10:
print "i is 5 and ii is 10"
Example 3: boolean python
print(10 > 9)
> True
print(10 < 9)
> False
bool("abc")
bool(123)
bool(["apple", "cherry", "banana"])
bool(False)
bool(None)
bool(0)
bool("")
bool(())
bool([])
bool({})