Practice with Relational and Logical Operators

Try these exercises for more practice with relational and logical operators.

1. Understanding Boolean Logic

The Boolean data type can be one of two values, either True  or False . We use Booleans in programming to make comparisons and to control the flow of the program.

Booleans represent the truth values that are associated with the logic branch of mathematics, which informs algorithms in computer science. Named for the mathematician George Boole, the word Boolean always begins with a capitalized B. The values  True and  False  will also always be with a capital T and F respectively, as they are special values in Python.

In this tutorial, we’ll go over the basics you’ll need to understand how Booleans work, including Boolean comparison and logical operators, and truth tables.

Source: Lisa Tagliaferri,
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.