QuestenaPractice that shows what to review next
Question 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`.Correct answer
  4. It is invalid syntax because comparisons cannot be chained.

Explanation

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`.

Continue with this test

Start practice
Question 56: Which description of `x < y <= z` is accurate? · Python Fundamentals · Questena