You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from microbit import *
import random
display.show(str(random.randint(1, 6)))
further down the page random seed is intorduced with this program for a dice
from microbit import *
import random
random.seed(1337)
while True:
if button_a.was_pressed():
display.show(str(random.randint(1, 6)))
The page then goes on to say "Can you work out why this program needs us to press button A instead of reset the device as in the first dice example..?"
when i set the seed to 123
I reset the microbit then press button_a to release each number and always get the sequence 6,1,1,1,1,1.
The pressing of button_a is doing nothing to effect the sequence of numbers
The program should be
from microbit import *
import random
random.seed(123)
while True:
number = random.randint(1, 6)
if button_a.was_pressed():
display.show(str(number))
The text was updated successfully, but these errors were encountered:
I'm looking at the page for random https://microbit-micropython.readthedocs.io/en/latest/tutorials/random.html
there is this program example of a dice
further down the page random seed is intorduced with this program for a dice
The page then goes on to say "Can you work out why this program needs us to press button A instead of reset the device as in the first dice example..?"
when i set the seed to 123
I reset the microbit then press
button_a
to release each number and always get the sequence 6,1,1,1,1,1.The pressing of
button_a
is doing nothing to effect the sequence of numbersThe program should be
The text was updated successfully, but these errors were encountered: