Code that runs in the real world
Students test their Python code on their own robots. Debugging becomes a game.
from robot import Robot
r = Robot()
while True:
if r.distance() < 20: # obstacle ahead
r.turn_left(90)
else:
r.forward(speed=60)