3. Built-in Images Code Ordering
3.1. Question 1
Put the lines of code in order to show a built-in happy face on the micro:bit screen.
Drag and drop lines into the correct order and click to adjust indentation:
☰
display.show(Image.HAPPY)
☰
☰
from microbit import *
3.2. Question 2
Arrange the code segments to create an ongoing animation loop that displays a built-in heart image, pauses for 700ms, clears the display, and pauses again for 300ms before repeating.
Drag and drop lines into the correct order and click to adjust indentation:
☰
while True:
☰
sleep(700)
☰
sleep(300)
☰
from microbit import *
☰
display.show(Image.HEART)
☰
display.clear()
☰
3.3. Question 3
A student wants to flash a warning arrow on the screen.
Order the blocks below to show the built-in arrow pointing North, pause for 200 milliseconds, and then show the arrow pointing South.
Drag and drop lines into the correct order and click to adjust indentation:
☰
sleep(200)
☰
display.show(Image.ARROW_S)
☰
from microbit import *
☰
☰
display.show(Image.ARROW_N)
3.4. Question 4
Put the instructions in the correct vertical order to build a program that shows the same series of faces on the micro:bit display, but with a 1 sec pause between each series.
Drag and drop lines into the correct order and click to adjust indentation:
☰
from microbit import *
☰
display.show(face_list, delay=500)
☰
sleep(1000)
☰
while True:
☰
face_list = [Image.HAPPY, Image.SMILE, Image.SAD]
☰
3.5. Question 5
Order the lines below to create a program that scrolls the letter “I” across the display, pauses for 300 milliseconds, shows a built-in heart image, pauses for 500 milliseconds, and finally shows a built-in diamond image for 1 second before repeating the sequence.
Drag and drop lines into the correct order and click to adjust indentation:
☰
sleep(500)
☰
☰
from microbit import *
☰
display.show(Image.DIAMOND)
☰
display.scroll('I')
☰
sleep(1000)
☰
sleep(300)
☰
while True:
☰
display.show(Image.HEART)