QuestenaUn entraînement qui indique quoi revoir ensuite
Question 63

When no break, return, or exception occurs, when does a while loop test its condition, and what makes repetition stop?

  1. Only once, before the loop; a return value stops it
  2. After every pass; a true condition stops it
  3. Before every pass; a falsy condition stops itBonne réponse
  4. Only after the body; an empty body stops it

Explication

The condition is checked before every attempted pass, so a false initial condition prevents the body from running at all. A post-body-only test would incorrectly guarantee at least one execution.

Continuer avec ce test

Commencer l’entraînement
Question 63: When no break, return, or exception occurs, when does a… · Python Fundamentals · Questena