0% found this document useful (0 votes)
0 views7 pages

Microbit Revision

The document contains a series of programming exercises for Grade 6 using the Microbit. Each question requires writing a program to perform specific tasks such as adding numbers, measuring temperature, computing expressions based on button presses, checking light levels, and displaying results. The provided code snippets illustrate how to implement these tasks using Microbit's functions.

Uploaded by

Yogesh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views7 pages

Microbit Revision

The document contains a series of programming exercises for Grade 6 using the Microbit. Each question requires writing a program to perform specific tasks such as adding numbers, measuring temperature, computing expressions based on button presses, checking light levels, and displaying results. The provided code snippets illustrate how to implement these tasks using Microbit's functions.

Uploaded by

Yogesh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

MICROBIT REVISION

Grade 6
Question 1
Q) Write a program to add two numbers (5 and 7) when Button A is
pressed and display the result. If Button B is pressed, subtract 4 from
12 and show the answer.

n1=4
n2=12
while True:
if button_a.is_pressed():
display.show(5+7)
if button_b.is_pressed():
display.show(n1-n2)
Question 2
Q) Write a program to measure temperature of the room. If the
temperature is 30 °C or more, display “WARMER” . Otherwise display
“COOLER”.

from microbit import*


t=temperature()
if t>=30:
display.show("WARMER")
else:
display.show("COOLER")
Question 3
Q) Write a program to compute (20 + 5) × 2 when Buttons A+B
are pressed together. Otherwise calculate 100 ÷ 5 and display it.
from microbit import*
x=(20+5)*2
y=100/5
while True:
if_button_a.is_pressed() and if_button_b.is_pressed():
display.scroll(x)
else:
display.scroll(y)
Question 4
Q) Write a program to check the light level. If below 30, divide 60 by
5 and display the result. Otherwise divide 100 by 10 and show the
answer.

from microbit import*


h=display.read_light_level()
while True:
If h< 30:
display.show(60/5)
else:
display.show(100/10)
Question 5
Q) When button B is pressed, double the number 8 and
display the result. Else, display "Low Value".
while True:
if button_b.is_pressed():
display.show(8*2)
else:
display.show("Low Value")
END

You might also like