Python Quest

Track 4 · Lesson 6 of 11

Input loops and sentinel values

Keep reading input until the user types a stop word, and re-ask for input until it is valid.

About 35 minBeginner4 exercises

You will be able to

  • Read input repeatedly until a sentinel value such as done appears
  • Use the read-before-the-loop, read-again-at-the-end pattern
  • Write a validation loop that keeps asking until the input is acceptable
  • Combine two conditions to limit the number of attempts

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.