Step 7 – Just three guesses
We need to limit the number of guesses to 3.
This makes things a little tricky so pay attention.
![Code helper image](riddle1/r9code1.png)
- Use the screenshot to make changes to your code to limit the guesses to 3
Take care here. Just change the bits you need to!
- Run your code and get the answer wrong 3 times. Does it work?
Don't forget the quotes ("), brackets and indents
That should work to limit the guesses to a maximum of three.
If that works then we can write a message at the bottom of the code using another if – else block.
This will tell the player how they did.
![Code helper image](riddle1/r9code2.png)
- Use the ideas in the screenshot to write your end of riddle message
You'll need to use print commands inside the if and the else
Watch the indent level. Python is really fussy about this
- Run your code and get the answer wrong 3 times. Does it work?
- Test your program works if you get the answer right on the first, second or third guess. It should work every time
Displaying the number of guesses
You might want to display the number of guesses someone took. That's quite easy, although there's a little trick to it.
This is an idea called concatenation. It doesn't involve tying cats together, but it does tie bits of the sentence together using + signs.