solved problem 15 in python