Problem 26 (python): solved