Problem 21 in the python