pxt-calliope/docs/lessons/guess-the-number/quiz.md

36 lines
851 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# guess the number quiz
2016-04-02 01:22:47 +02:00
Learn how to generate a random number on the micro:bit.
2016-03-26 00:47:20 +01:00
## Name
## Directions
2016-03-31 01:10:27 +02:00
Use this activity document to guide your work in the [guess the number tutorial](/microbit/lessons/guess-the-number/activity).
2016-03-26 00:47:20 +01:00
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Describe what "input -> on button pressed" does?
<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-30 01:24:11 +02:00
```blocks
2016-03-26 00:47:20 +01:00
let randomNumber = Math.random(10)
basic.showNumber(randomNumber, 150)
```
![](/static/mb/empty-microbit.png)
<br />