# Python Boolean

In this tutorial you will learn:

• Boolean in Python
• Boolean expressions
• Importance of Boolean in programming.

Boolean in Python

Boolean is perhaps one of the most simple yet the most powerful data type not only in Python but in other programming languages as well. Boolean data type has either a value of True or a value of False. Even the keywords used in Python to define Booleans are True and False.

`myTrueBool = True myFalseBool = False`

They can also act like numbers in some scenarios such as in arithmetic operations. In that case 0 represents false and 1 represents true.

Boolean expressions

An expression which can result to a Boolean value is called a Boolean expression.

For example:

`9 == 1 #False 4 == 4 #True 3 == 0 #False`

Booleans work using truth tables and we can determine what value of boolean to expect after checking the truth table. Mostly used truth tables are of AND, OR and XOR.

Importance of Boolean in programming

If it weren’t for Booleans we won’t have conditional statements in programming. Whenever we want to make a decision based on if a certain criteria is true or false then we use conditional statements. For making conditional statements we make use of the truth tables.

 A B not A not B A == B A =! B A or B A and B T F F T F T T F F T T F F T T F T T F F T F T T F F T T T F F F