exercises on the algorithms (python)