Puzzle 1 – guessing a number

Step 4 – finishing off

In the last part of the program all we need to do is to tell the user they got it right.

Scratch code image

This happes after the Repeat – Until loop has finished in Scratch, so it will only ever happen once and only when the player gets the answer right. In Python it needs to happen after the While loop.

IMPORTANT: this line of code has to go at the same indent level a the very first line of code in your program. So all the way to the left. You don't want it inside the loop at all.

  1. Use a print line to do this – the code should be back at the same indent level as the code at the beginning of the program
  2. Save your program
  3. Run your program
  4. Run it several times to check it always works right and to correct any errors

That's the basic program done. But we can get more advanced now as well.