Step 1 of 6

Step 1 · Read and run

Ask again

People type the wrong thing. A while loop can keep asking until the answer makes sense. Checking input like this is called validation.

The pattern is:

  1. Ask once, before the loop.
  2. While the answer is no good, say what's wrong and ask again.
  3. After the loop, the answer is sure to be good.

Run it and try 0, then 12, then 7.

Run the program to carry on.
rating.py

Output

Press Run to see what your program prints.