updated lessons
This commit is contained in:
92
docs/lessons/prank-wifi/quiz-answers.md
Normal file
92
docs/lessons/prank-wifi/quiz-answers.md
Normal file
@ -0,0 +1,92 @@
|
||||
# prank wifi quiz answers
|
||||
|
||||
create a fake wifi app to trick your friends #string #forever #abs #var #plot #image #if #math #abs #acceleration #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [prank WiFi tutorial](/microbit/lessons/prank-wifi/tutorial)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Write the lines of code that takes the absolute value of the accelerations with respect to the x, y and z axis and stores the values as Local Variables
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
let xAccel = math.abs(input.acceleration("x"))
|
||||
let yAccel = math.abs(input.acceleration("y"))
|
||||
let zAccel = math.abs(input.acceleration("z"))
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the lines of code that add all the accelerations together to get the total acceleration and stores the value as a Local Variable called "sum"
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
let sum = xAccel + yAccel + zAccel
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Write the 'If statement' used if the sum of the acceleration value is less than 1400 milli-gravitys. Then write the code that will plot an image of the fake amount of WiFi if the acceleration in this 'If statement'
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
if (sum < 1400) {
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # . .
|
||||
# # # . .
|
||||
`)
|
||||
}
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Write tje 'If statement' used if the sum of the acceleration value is greater than 1400 milli-gravitys but less than 1680 milli-gravitys. Then write the code that will plot an image of the fake amount of WiFi inside this 'If statement'
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
if (sum >= 1400 && sum < 1680) {
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . # .
|
||||
. . # # .
|
||||
. # # # .
|
||||
# # # # .
|
||||
`)
|
||||
}
|
||||
```
|
||||
|
||||
## 5. Write the 'if statement' needed to display this specific plot image on the device
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
if (sum >= 1680) {
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# . . . .
|
||||
`)
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user