Logical Operators are used to perform logical operation between two given conditional statements.
Operator | Description | Syntax |
and | It will return True, if both statements are true. | a and b |
or | It will return True, if one of the statements is true. | a or b |
not | It reverse the result, returns False if the result is true. | not a |
Example:
a = 5
print(a < 6 and a < 7)
print(a > 6 and a < 8)
print(not(a < 6))
Output:
True False False