BluePi Interview Question

Basic logic.