This sensor allows the micro:bit to detect the current temperature of the device, in degrees and Celsius.

from microbit import *

while True:
    val = temperature()
    display.scroll(val)
    sleep(5000)

DIY

Give a program that gived temperature when the A button is pressed.