Python or Keyword

Example

If one of the statements is True, the return value is True:

x = (5 > 3 or 5 > 10)
print(x)

Run Instance

Definition and Usage

The or keyword is a logical operator.

Logical operators are used to combine conditional statements.

If one of the statements returns True, the return value is True, otherwise False.

More Examples

Example

Use the or keyword in if statements:

if 5 > 3 or 5 > 10:
  print("At least one of the statements are True")
else:
  print("None of the statements are True")

Run Instance

Related Pages

Keyword and and not It is also a logical operator.

Please visit our Python Operator Tutorial Learn more about operators in Chinese.