Logical operators
Logical operators are used to determine, whether the relationship between the phases is false or true.
Returns True or False depending on the relationship of the phases.
Python basically has 3 logical operators.
Operator | Operation |
---|---|
and | Logical AND |
or | Logical OR |
not | Logical NOT |
Logical and operator
In and operator, when the two phases are true then only this operation is true or returns True.
Logical or operator
In or operator, the operation performed is true or returns True, when either one of the phases are true.
This operation returns or is false, only when both the phases are false.
Logical not operator
Returns the opposite of the result. If the result is True then it returns False and if the result is False it will returns True.
Conclusion
Logical operators are used to determine, whether the relationship between the phases is false or true.
Following are the logical operators in Python.
In and operator, when the two phases are true then only this operation returns or is true.
In or operator, the operation performed returns or is true, when either one of the phases are true.
The not operator returns the complement.
إرسال تعليق
If you have any query, feel free to ask.