-1

I'm trying to make a higher or lower game for my sisters microbit and am having problems with my variables random_int & r_number:

from microbit import *
import random

random_int = random.randint(0, 9)
r_number = 7
while True:
    display.scroll(r_number)
    if button_a.is_pressed():
        display.scroll("HIGHER")
        r_number = random_int
        display.scroll(random_int)
        if r_number =< random_int):
            display.scroll('correct')
        elif r_number >= random_int):
            display.scroll('incorrect')
        r_number = random_int  

    elif button_b.is_pressed():
       display.scroll("LOWER")
        r_number = random_int
        display.scroll(random_int)
        if r_number => random_int):
            display.scroll('correct')
        elif r_number <= random_int):
            display.scroll('incorrect')
        r_number = random_int  
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

Not sure what this is supposed to do. Not withstanding you only initialise your main variables once, and that outside of your main loop, I see syntax errors like that in #12 i.e. "if r_number =< random_int):" That widowed closing bracket looks a mite strange to me. The micro:bit's is not very forgiving, and it's compilers not very forthcoming.

Clarius
  • 1,183
  • 10
  • 10