Python Forum
Grok Acedemy Sport Microbit Tilt Both Ways Help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Grok Acedemy Sport Microbit Tilt Both Ways Help (/thread-44428.html)



Grok Acedemy Sport Microbit Tilt Both Ways Help - happyhippo - May-03-2025

Hello, im currently doing the grok academy sport microbit course and im up to ‘Tilt Both ways’ an activity in module 5. I have cleared most of the tests besides the test thats states ‘Testing many different values.’ it said i failed that test because ‘Display was showing Image.ARROW_S.’


My Current code is as follows:
from microbit import *

while True:
  if accelerometer.get_y() > 500:
    display.show(Image.ARROW_S)
  elif accelerometer.get_y() < -500:
    display.show(Image.ARROW_N)
  if accelerometer.get_x() > 500:
    display.show(Image.ARROW_E)
  elif accelerometer.get_x() < -500:
    display.show(Image.ARROW_W)
  elif accelerometer.get_y() == 0 and accelerometer.get_x()== 0:
    display.show(Image.TARGET)
what am i doing wrong? (btw this is my first time using this website and i just copy pasted the code straight into this so the indentation isnt showing up but im fairly sure i have the correct indentaion)


RE: Grok Acedemy Sport Microbit Tilt Both Ways Help - Larz60+ - May-03-2025

should line 8 be elif as well?