51 lines
1.1 KiB
Markdown
51 lines
1.1 KiB
Markdown
# flipping bird quiz answers
|
|
|
|
use modulo with a conditional.
|
|
|
|
This is the answer key for the [flipping bird quiz](/lessons/flipping-bird/quiz).
|
|
|
|
## 1. What does "modulo" mean in math?
|
|
|
|
<br/>
|
|
|
|
Modulo (or Mod) is the remainder of a division problem.
|
|
|
|
## 2. Consider the following code
|
|
|
|
If the rectangle below represents the @boardname@, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
|
|
|
|
```
|
|
count = 1
|
|
count_ = count_ + 2
|
|
```
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
![](/static/mb/lessons/flipping-bird-0.png)
|
|
|
|
The variable `count` is now equal to 3.
|
|
|
|
<br/>
|
|
|
|
## 3. Consider the following directions
|
|
|
|
Modulo (Mod) tells us what the remainder of a division is. For example, `15 mod 4 is 3` since 15 divided by 4 has a remainder of 3.
|
|
|
|
```
|
|
count = 12
|
|
count = math.mod(count, 5)
|
|
```
|
|
|
|
If the rectangle below represents the @boardname@, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
![](/static/mb/lessons/flipping-bird-1.png)
|
|
|
|
The display will show `2` because the remainder of 12 divided by 5 is 2.
|
|
|