Add solution for problem 10 in Python