Question d’entretien chez Turing

A puzzle to solve using python.