Prev
Python for you and me
Next
4.4. Logical Operators
To do logical AND , OR we use
and
,
or
keywords.
x and y
returns
False
if
x
is
False
else it returns evaluation of
y
. If
x
is
True
, it returns
True
.
>>>
1
and
4
4
>>>
1
or
4
1
>>>
-
1
or
4
-
1
>>>
0
or
4
4
Prev
4.3. Relational Operators
Up
Home
Next
4.5. Shorthand Operator