CleverAlgorithm in Python