Python-logical-operators-example

提供:Dev Guides
移動先:案内検索

Python論理演算子の例

Python言語でサポートされている論理演算子は次のとおりです。 変数aが10を保持し、変数bが20を保持すると仮定します-

Operator Description Example
and Logical AND If both the operands are true then condition becomes true. (a and b) is true.
or Logical OR If any of the two operands are non-zero then condition becomes true. (a or b) is true.
not Logical NOT Used to reverse the logical state of its operand. Not(a and b) is false.