The goal is to understand how Boolean variables and logical operators work in Python.

Boolean variables

A Boolean variable is either true or false. In Python, these are written in the following way:

==============================
 
p = True  
q = False  
==============================

Boolean values appear when doing comparisons. Try the following:

Boolean values also determine the behavior of if/else statements and while loops.

Logical Operators

(a)
The negation operator:
     ==============================
      
not p  
==============================
(b)
The AND operator:
     ==============================
      
p and q  
==============================
(c)
The OR operator:
     ==============================
      
p or q  
==============================

Problems

(a)
With true and false, compute the truth value of the following:
(i)
(ii)
(Hint: There is no conditional operator, so use an equivalent form)
(iii)
(iv)
(b)
Use the code here to construct truth tables for the following problems:
(i)
Construct a truth table for .
(ii)
Construct a truth table for .
(iii)
Construct a truth table that shows that .