2. Lessons Gapfill Review

2.1. Question 1

A safety engineer is coding a heavy cargo lift warning flash.
Fill in the gaps to make the screen flash each character of the word “UP” with an extra-fast custom character speed of 150 milliseconds.
from microbit import *

while True:
display.("UP", )

2.2. Question 2

A student is making a solar tracker that displays a long message explaining where the sun is.
Fill in the gaps to choose the correct function that slides long sentences smoothly sideways across the LEDs.
from microbit import *

while True:
display.("PANEL ALIGNED TO EAST")

2.3. Question 3

Complete this smart night-light script.
It checks if Button A is pressed right at this exact split-second to turn on a bright smile, or clears the grid if left alone.
from microbit import *

while True:
if button_a.():
display.show(Image.HAPPY)
:
display.clear()

2.4. Question 4

A developer is building a scoreboard that tracks a player’s lives.
Complete the loop header structure so it scans through every single character inside the life tracker string.
from microbit import *

health_bar = "HEARTS"
char health_bar:
display.show(char)
sleep(500)

2.5. Question 5

This script builds an automatic greenhouse water mister that runs exactly 4 times in a row using a basic number generator block.
Complete the function arguments so it loops precisely 4 times, starting its internal count at 0.
from microbit import *

for spray_count in :
display.show(Image.STICKFIGURE)
sleep(800)
display.clear()
sleep(200)

2.6. Question 6

Complete this linked multi-choice control switch panel.
If Button A is held down, show a text label. If Button B is held down instead, show a different label. Otherwise, wipe the screen.
from microbit import *

while True:
if button_a.is_pressed():
display.show("A")
button_b.is_pressed():
display.show("B")
:
display.clear()

2.7. Question 7

A gaming badge counts click history events.
Fill in the gaps to capture if a user clicked a button in the past, automatically clearing out that memory log right after checking it.
from microbit import *

while True:
if button_b.():
display.scroll("POINT ADDED")
sleep(100)

2.8. Question 8

Complete this digital combination padlock script.
It loops through a text string variable of secret passcode digits to reveal them one by one.
from microbit import *

passcode = "9021"
for digit in :
display.(digit)
sleep(300)

2.9. Question 9

Complete this speed-demon test loop that scrolls a player’s custom lap time variable text with an advanced tracking delay of 75 milliseconds.
from microbit import *

lap_time = 14.2
while True:
display.scroll("LAP TIME=", )
display.scroll()

2.10. Question 10

This arcade controller uses Button A to raise a high-score integer variable, but uses the mathematical min function to stop the score from going higher than 9.
from microbit import *

current_score = 5
while True:
if button_a.was_pressed():
current_score = (9, )
display.show()