Logical Operator
Logical Operator
|
Sign
|
Description
|
Logical And
|
AND
|
If 2 conditions are true
then it returns true.
|
Logical Or
|
OR
|
If 1 of the two conditions is true then it returns true.
|
Logical Not
|
NOT
|
This operator spin false
to true or true to false
|
Logical AND (and) Logical Operator in Python
Source Code:
a = 9
b = 10
print ((a <b) and (b> a))
Output:
True
Logical OR (or) Logical Operator in Python
Source Code:
a = 9
b = 10
print ((a <b) or (b> a))
print ((a <b) or (b <a))
Output:
True
True
Logical Operator |
Logical NOT (not) Logical Operator in Python
Source Code:
a = 9
b = 10
print (not (a> b))
print (not (a <b))
Output:
True
False
Learn C Language click here
Click here to install and setup the Python
0 Comments