print(ktra,'là',bool(ktra))
ktra = [0]
print(ktra,'là',bool(ktra))
ktra = 0.0
print(ktra,'là',bool(ktra))
ktra = None
print(ktra,'là',bool(ktra))
ktra = True
print(ktra,'là',bool(ktra))
ktra = 'TipsMake.com'
print(ktra,'là',bool(ktra))
In this program, we will check a series of values, see bool () function returns False or True, we have the following output:
[] là False
[0] là True
0.0 là False
None là False
True là True
TipsMake.com là True
See more: