Python Quest

Track 9 · Lesson 7 of 11

Validating input

Write input loops that never crash on a typo, convert safely, handle the end of input, and report every problem clearly to the user.

About 40 minIntermediate4 exercises

You will be able to

  • Write a loop that keeps asking until the user enters a valid value
  • Separate 'not a number' from 'a number outside the allowed range' and report each clearly
  • Handle EOFError when input runs out
  • Validate a whole form and report all its errors at once instead of stopping at the first

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.