Problem 21 solved (python)