Riddle me this – it's all Greek to me

Step 6 – Repeating until it's right

The problem with our program so far is that it only asks the riddle once.

I guess the Sphinx might just eat you if you get it wrong first time, but maybe we should play fair and give the guesser three guesses.

To do this we're going to have to use a loop to repeat the code.

Code helper image
  1. You're going to need to CHANGE YOUR CODE to how it looks in the screenshot

    This adds only 3 lines of code BUT you need to change a lot of indents

    This uses a while loop to keep asking until the answer is right

    Can you see that I've used a new variable called correct to use to tell the program is the answer is correct?

  2. Run your code to check that it works

    Don't forget the quotes (") and brackets. And the idents are really important

    If your loop gets stuck and you can't stop the progam, just close the window down that the program is running in. Python will ask you if you want to "kill" the program (dramatic!). Say yes.

Loops let you keep going until something happens. Of course, if you don't get the right answer the loop will never stop. You'll be stuck here forever.