logo

Crowdly

The boolean constants in Python are True and False , and the operators for co...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

The boolean constants in Python are True and False, and the operators for combining boolean expressions are and, or, and not. If <<expr1>> and <<expr2>> are two boolean expressions, then:

  • the boolean expression <<expr1>> and <<expr2>> evaluates to true exactly when both <<expr1>> and <<expr2>> evaluate to true, and evaluates to false otherwise;
  • the boolean expression <<expr1>> or <<expr2>> evaluates to true when at least one of <<expr1>> and <<expr2>> evaluate to true, and evaluates to false otherwise; and
  • the boolean expression not <<expr1>> evaluates to true exactly when <<expr1>> evaluates to false, and vice-versa.

What do you think the order of precedence is between and, or and not? You can check the answers by extending your program in expressions.py to print out the result of evaluating the following boolean expressions.

    Більше питань подібних до цього

    Хочете миттєвий доступ до всіх перевірених відповідей на moodle.royalholloway.ac.uk?

    Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!