6 Are you a mind reader?
![](https://drek4537l1klr.cloudfront.net/aldred/v-11/Figures/ch-06__image001.png)
This chapter covers
- Checking if an input matches a value
- Creating a while loop
- Conditional logic with ‘if’ an ‘else’
- Giving a different response based on a condition
- Using else if (elif) and else to respond
A classic binary search guessing game (higher or lower), “I am thinking of a number between 1 and 100. Can you guess what it is?” You are then given five chances to guess the number correctly. Before you begin this chapter, you may want to challenge someone to play the game as a reminder about how it works. Or we can play, I am thinking of a number between 1 and 100, what is your first guess….!
WHAT YOU WILL BUILD
In this chapter you will build a version of the higher or lower number guessing game where a witch or other character of your choice has chosen a number between 1 and 100. They have given you five lives or chances to get it right, if you do guess correctly, then you are free to go. You have won. Unfortunately, if you do not guess the correct number in five tries, then you lose. On the positive side, if you do guess the number correctly, the witch will invite you to try again, if you dare! Figure 6.1
Figure 6.1 Can you guess the number and beat the witch?
![](https://drek4537l1klr.cloudfront.net/aldred/v-11/Figures/ch-06__image003.png)
![](https://drek4537l1klr.cloudfront.net/aldred/v-11/Figures/ch-06__image005.png)