Logical operations involve comparing two or more boolean values (True or False) and returning a boolean result. They are fundamental in computer science, mathematics, and digital logic.
Basic Logical Operators
Operator
Symbol
Description
Example (Python)
AND
and
Returns True if both conditions are True
True and False → False
OR
or
Returns True if at least one condition is True
True or False → True
NOT
not
Negates the boolean value
not True → False
Truth Tables
AND (and) Truth Table
A
B
A AND B
True
True
True
True
False
False
False
True
False
False
False
False
OR (or) Truth Table
A
B
A OR B
True
True
True
True
False
True
False
True
True
False
False
False
NOT (not) Truth Table
A
NOT A
True
False
False
True
Operator Precedence (Priority Order)
NOT (not)
AND (and)
OR (or)
To ensure clarity, use parentheses () to group operations when there are multiple logical expressions.
Examples in Programming
Simple Conditionx = 5 print(x > 3 and x < 10) # True
One thought on “Logical Operations”