











‘AND’ ‘OR’ and ‘NOT’


‘AND’,’OR’ and ‘NOT’ Keywords in Python
A logical operator is a symbol or word used to link two or more expressions in such a way that the value of the generated compound expression depends solely on that of the original expression and the operator’s meaning.
Some of the familiar logical operators are AND, OR and NOT.
All these logical operator returns boolean value
AND Keyword
It is one of the logical operator used to combine conditional statements.
It returns True only if both of the conditions are True else it returns False.
Syntax –
condition1 and condition2
Both conditions in given code is true so if statement executed
AND works fine
OR Keyword
It is one of the logical operator used to combine conditional statements.
It returns True if any of the conditions are True else it returns False.
Syntax –
condition1 or condition2
Here a >2 is True but b!=5 is False
Hello world!
NOT Keyword
It returns True if input is False and returns False if input is True
NOT acts like as inverter
Syntax –
not var1
I am not there
Login/Signup to comment