Python Logical Operators:
We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it. |
(1) These operators are also called Boolean Operators. With Boolean Operators, we perform logical operations. These are most often used with if and while keywords. These operators are also used to combine one or more than one relational expressions. There are three logical operators supported by Python. These operators (and, or, not) are to be written in lowercase only.
Operator | Description |
---|---|
and | Returns True if both statements are true. |
or | Returns True if one of the statements is true. |
not | Reverse the result, returns False if the result is true. |
(2) Example of and operator.

(3) Example of or operator.

(4) Example of not operator.

Comments (No)