# Using recursion to make the robot check it's IR sensors # for something sneaking up behind it (and flee) 50 times. # from Myro import * init() def flee(numLeft): if numLeft <= 0: return print("Checking IR:", numLeft) result = getIR("left") if result == 0: print("Running Away") forward(1,1) else: print("all clear!") wait(1) flee(numLeft -1) flee(50)