Adding problem 30 in python