Skip to content

crwdns342183:0crwdne342183:0

crwdns347525:0crwdne347525:0

crwdns347531:0crwdne347531:0 | MakeCode, Python | crwdns255566:0crwdne255566:0, crwdns255570:0crwdne255570:0 | crwdns258516:0crwdne258516:0, crwdns258562:0crwdne258562:0, crwdns293306:0crwdne293306:0, crwdns337031:0crwdne337031:0

crwdns336973:0crwdne336973:0

crwdns336975:0crwdne336975:0

crwdns336977:0crwdne336977:0

crwdns336979:0crwdne336979:0

crwdns336985:0crwdne336985:0

  • crwdns336987:0crwdne336987:0
  • crwdns336989:0crwdne336989:0
  • crwdns336991:0crwdne336991:0 crwdns336993:0crwdne336993:0
  • crwdns336995:0crwdne336995:0 crwdns336997:0crwdne336997:0 crwdns336999:0crwdne336999:0
  • crwdns337001:0crwdne337001:0

crwdns337003:0crwdne337003:0

  • crwdns337005:0crwdne337005:0
  • crwdns337007:0crwdne337007:0

crwdns337011:0crwdne337011:0

1from microbit import *
2import random
3a = 0
4b = 0
5
6# Shake the micro:bit to see the answer in the Python version
7while True:
8    if accelerometer.was_gesture('shake'):
9        display.scroll(a*b)
10    if button_a.was_pressed():
11        a = random.randint(1, 12)
12        display.scroll(a)
13    if button_b.was_pressed():
14        b = random.randint(1, 12)
15        display.scroll(b)

crwdns337013:0crwdne337013:0

  • crwdns337015:0crwdne337015:0
  • crwdns337017:0crwdne337017:0
  • crwdns337019:0crwdne337019:0