Booleans

a = True
b = False
print(a)
print(type(b))


Booleans

a = True
b = False
print(a)
print(type(b))

True
<class 'bool'>

Conversion

a = bool("True")

  • False, 0, None or 0 length : False
  • Any other value : true

Conversion

print(bool("True"))
print(bool("False"))


Conversion

print(bool("True"))
print(bool("False"))

True
True

Conversion

print(bool(0))
print(bool(1))
print(bool(""))



Conversion

print(bool(0))
print(bool(1))
print(bool(""))

False
True
False