QuestenaПрактика, после которой понятно, что повторить
Вопрос 56

Which description of `x < y <= z` is accurate?

  1. It means `x < y` or `y <= z`.
  2. It means `x < y` and `x <= z`.
  3. It requires `x < y` and `y <= z`, with one evaluation of `y`.Правильный ответ
  4. It is invalid syntax because comparisons cannot be chained.

Объяснение

The chain requires both neighboring comparisons to hold and evaluates the middle expression only once. Comparing `x` directly with `z` for the second test changes the meaning, while writing two separate comparisons can reevaluate `y`.

Продолжить работу с тестом

Начать тренировку
Вопрос 56: Which description of `x < y <= z` is accurate? · Python Fundamentals · Questena