completed problem fourteen in python