Logical Comparisons Flashcards
How many Comparison Operators are there in python?
- ==
- !=
- >
- <
- > =
- <=
_________ compare variables and output a Boolean value (True or False).
Comparison Operators
Chained Comparison Operators
How many statements are there in chained comparison operators?
and
or
not
____ is used to make sure two checks have to be true in order for the total check to be true.
and
1 == 2 or 2<3
True.
this is because of the ___ operator
or
Because, we only need one or the other to be true.
Run a code as an example for
and statement.
1 < 2 < 3 (instead of this)
OUTPUT : True
1<2 and 2<3
OUTPUT : True
Run a code for or statement.
1 == 2 or 2<3
When u want to get the result which is opposite to the real one, which operator is used?
not
Run a code for not statement.
1 == 2
OUTPUT: False
not 1 == 2
OUTPUT: True