--- title: booleans tags: - python - bool - logic - expressions aliases: - true - false - boolean - bools --- > [!note] Concept > Python uses the `bool` type to represent truth values. It has only two values: `True` and `False`, both of which are subtypes of `int`. > > > [!example] Assigning Boolean Values > > ```python > > true_variable = True > > false_variable = False > > ``` > > > [!example] Boolean Expressions > > ```python > > result = True and True # True > > result = True and False # False > > result = False or True # True > > result = False or False # False > > result = not False # True > > result = not True # False > > ``` > > > [!important] Best Practices > > - `True` and `False` must be capitalized. > > - Use boolean logic to control flow and conditionals. > > - Booleans are a subtype of `int`: > > ```python > > int(True) # 1 > > int(False) # 0 > > ``` > > > > [!info]- 🔗 Related Notes > > - [[logicalOperators]] — details `and`, `or`, `not` in more depth > > - [[conditionals]] — where booleans are used for flow control > > - [[typeConversions]] — shows how other types convert to `bool` > > - [[numericTypes]] — relevant because `bool` is a subtype of `int` >