SHOW:
|
|
- or go back to the newest paste.
| 1 | from microbit import * | |
| 2 | import random | |
| 3 | ||
| 4 | tries = 3 | |
| 5 | for i in range(tries): | |
| 6 | counter = 0 | |
| 7 | sleep_time = random.randint(2000,5000) #creates a random number between 2000 and 5000 | |
| 8 | sleep(sleep_time) # does nothing for 2-5 seconds | |
| 9 | display.show(Image.SKULL) | |
| 10 | while True: | |
| 11 | counter += 1 | |
| 12 | sleep(10) | |
| 13 | if button_a.is_pressed(): | |
| 14 | display.scroll(str(counter) + 'hundrethds',60) # prints out reaction time | |
| 15 | break | |
| 16 | ||
| 17 | #TASK 2: Once the program has run 3 times print best time with button b and average with button a |