Python or Keyword

The or keyword in Python returns True, if any of the expression, statements or operands evaluates to be True. For example:

a = 50
b = 60
c = 70
d = 80

print(a>b or b>c or d>c)

The output is:


Note - The or, a logical operator, returns False, only if all expression evaluates to be False

Truth Table of or Keyword in Python

The table given below shows the truth table of Python or keyword:

X Y X or Y
True True True
True False True
False True True
False False False

Python or Keyword Example

Here is an example of or keyword in Python:

print(True or False)
print(False or False)
print(True or True)
print(True or True or True or False or True or True)
print(False or False or False or False or False)

The output is:


Python Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube