2016-03-25 16:47:20 -07:00
# answering machine blocks challenges
Coding challenges for the answering machine tutorial.
## Before we get started
2016-04-13 08:27:45 -07:00
Complete the [answering machine ](/lessons/answering-machine/activity ) activity and your code will look like this:
2016-03-25 16:47:20 -07:00
```blocks
basic.showString("ASK ME A QUESTION")
```
### Challenge 1
2016-11-01 17:44:37 -07:00
Now we need to reply after someone asks @boardname @ a yes or no question. We want to respond `YES` when button `A` is pressed. Add a condition for button `A` and inside it show the string `YES` .
2016-03-25 16:47:20 -07:00
```blocks
basic.showString("ASK ME A QUESTION")
input.onButtonPressed(Button.A, () => {
basic.showString("Yes")
})
```
* `Run` the code to see if it works as expected.
### Challenge 2
2016-11-01 17:44:37 -07:00
What if @boardname @'s answer to the question is no? Let's have `NO` be displayed when button `B` is pressed. Add a condition for button `B` and inside it show the string `NO` .
2016-03-25 16:47:20 -07:00
```blocks
basic.showString("ASK ME A QUESTION")
input.onButtonPressed(Button.A, () => {
basic.showString("Yes")
})
input.onButtonPressed(Button.B, () => {
basic.showString("NO")
})
```
* `Run` the code to see if it works as expected.
2016-05-06 09:28:26 -07:00
### Challenge 3
2016-03-25 16:47:20 -07:00
2016-05-06 09:28:26 -07:00
When you are asked a yes or no question, do you always say yes or no? Add a condition for `on shake` that displays `MAYBE` .