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

In one `if`, `elif`, `else` chain, both the `if` condition and an `elif` condition are truthy. Which suite executes?

  1. Only the suite under the first truthy `if` conditionПравильный ответ
  2. Both the `if` and `elif` suites
  3. Only the `elif` suite
  4. The `if` suite followed by the `else` suite

Объяснение

The chain selects the first truthy condition, executes its suite, and skips all later alternatives. Running the `elif` suite as well would treat mutually exclusive branches as independent `if` statements.

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

Начать тренировку
Вопрос 49: In one `if`, `elif`, `else` chain, both the `if` condition… · Python Fundamentals · Questena