# Python CodeRecipe|orの使い方

Home Python Keywords

# orの例1

Return True if one of the statements are True:

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

# orの定義及び使い方

or関数は論理演算子です。 論理演算子は、条件文を結合するために使用します。 次のいずれかの場合、戻り値はTrueになります。 文はTrueを返し、それ以外の場合は次のようになります。 Falseを返します。

# orの例2

Using the or keyword in an
  if statement:

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

Related Pages The keywords and, and not are also logical operators. Read more about operators in our Python Operators Tutorial.

Home Python Keywords