file management quizzes
This commit is contained in:
@ -1,54 +0,0 @@
|
||||
# counter quiz answers
|
||||
|
||||
Learn how to create a counter with the BBC micro:bit button.
|
||||
|
||||
This is the answer key for the [counter quiz](/microbit/lessons/counter/quiz).
|
||||
|
||||
## 1. What is a variable?
|
||||
|
||||
Answers may vary but a variable is a place where you can store and retrieve data
|
||||
|
||||
## 2. Draw the stored value for the variable called count
|
||||
|
||||
```
|
||||
let count = 0
|
||||
```
|
||||
|
||||

|
||||
|
||||
We create a **variable**, `count` to keep track of the current count. The number 0 is stored into memory of the variable.
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count, 150)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
We are only pressing on button pressed once. So the number to display on the micro:bit is also one.
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
We included the code ``on button pressed("A")`` that runs each time the user presses A. The code increments `count` by `1`. We increase `count` by 1 whenever the user presses the button. So the third time the A button is pressed on the BBC micro:bit, the number 3 is displayed
|
||||
|
||||
<br/>
|
||||
|
@ -1,54 +0,0 @@
|
||||
# counter quiz
|
||||
|
||||
Learn how to create a counter with the BBC micro:bit button.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [counter tutorial](/microbit/lessons/counter/activity).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. What is a variable?
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Draw the stored value for the variable called count
|
||||
|
||||
```
|
||||
let count = 0
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
Reference in New Issue
Block a user