Solved 33, 37. Factor out digits function