Page 123 - PortGPT_V2.1_C6_Flipbook
P. 123
The output of the above program is:
Logical Operators
Logical operators are used to evaluate and decide. Python supports the following logical operators:
Operator Name Description Example (x=2) Output
and AND It returns true, if both operands are (x < 5) and (x < 10) TRUE
true.
or OR It returns true, if one of the operands is (x < 5) or (x < 2) TRUE
true.
not NOT It reverses the result, returns false, if not [(x < 5) and (x < 10)] FALSE
the result is true or vice versa.
Program 3: To perform all the logical operators.
The result of the above program will be:
Introduction to Programming 121

