search

What is the use of the "or" keyword in Python?

The "or" keyword in Python is used as a logical operator to combine two or more conditions. It evaluates to **True** if at least one of the conditions is **True**, and **False** if all conditions are **False**. For example:

a = 5
b = 10

if a < 10 or b > 10:
  print("At least one of the conditions is True")
else:
  print("Both conditions are False")

The code above will print "At least one of the conditions is True", because **a < 10** is **True**.

Related Questions You Might Be Interested