Skip to content

Boolean (bool)

Boolean is use when for the results of logical determination and it only has 2 value, which is True and False

INFO

  • True represents 1
  • False represents 0

Usage:

boolean.py

py
x = True
y = False

print(x)
print(y)

print(type(x))
print(type(y))

print(x == 1)
print(y == 0)

INFO

a == b (double equal) means whether is a equal to b.

Results:

True
False
<class 'bool'>
<class 'bool'>
True
True