from microbit import * import random tries = 3 for i in range(tries): counter = 0 sleep_time = random.randint(2000,5000) #creates a random number between 2000 and 5000 sleep(sleep_time) # does nothing for 2-5 seconds display.show(Image.SKULL) while True: counter += 1 sleep(10) if button_a.is_pressed(): display.scroll(str(counter) + 'hundrethds',60) # prints out reaction time break #TASK 2: Once the program has run 3 times print best time with button b and average with button a
Comments