2016-03-25 16:47:20 -07:00
|
|
|
# guess the number quiz
|
|
|
|
|
2016-11-01 17:44:37 -07:00
|
|
|
Learn how to generate a random number on the @boardname@.
|
2016-03-25 16:47:20 -07:00
|
|
|
|
|
|
|
## Name
|
|
|
|
|
|
|
|
## Directions
|
|
|
|
|
2016-04-13 08:27:45 -07:00
|
|
|
Use this activity document to guide your work in the [guess the number tutorial](/lessons/guess-the-number/activity).
|
2016-03-25 16:47:20 -07:00
|
|
|
|
|
|
|
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
|
|
|
|
2018-11-09 15:36:46 -08:00
|
|
|
## 1. Describe what ``||input:on button pressed||`` does?
|
2016-03-25 16:47:20 -07:00
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
## 2. Write the line of code that creates a condition for on button A pressed.
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
## 3. Write the line of code that creates a `local variable` called `randomNumber` and will return a number from 0 to a limit of 10.
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
## 4. Draw the area that could be lit based on the code below. Explain why you chose to draw that number.
|
|
|
|
|
2016-03-29 16:24:11 -07:00
|
|
|
```blocks
|
2018-06-01 11:42:38 -07:00
|
|
|
let randomNumber = Math.randomRange(0, 10)
|
2018-11-09 15:36:46 -08:00
|
|
|
basic.showNumber(randomNumber)
|
2016-03-25 16:47:20 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
![](/static/mb/empty-microbit.png)
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|