Times Table Tester

Step 6 – Looping the program

I want to make the user keep doing the question until they get it right. I'm mean like that.

To do this I need to use a loop.

THEORY: when we use a loop we're doing repetition. That means doing a section of code more than once. Because I'm going to need to do this until the answer is right, I need to use a while loop.

There's a few things to do here, so take care.

Code helper image
  1. First set a new variable called correct to be equal to False

    We need this to be set before we start to use it

  2. Then set up the while line

    What we're doing here is saying, do this all the time that correct is False

  3. Then you need to indent the rest of the code. A standard indent is 4 spaces, but a quick way to do this is to use the TAB key (top left of the keyboard, above Caps Lock)
  4. Then add a line to set correct to True if they get the answer right
  5. Delete the line where you give them the right answer

    We don't need this if we're going to make them give an answer until they get it right!

  6. Now run the program

That should work, but the indents are tricky so you might run into problems. Take care, check the screenshot and read the error messages.