I need to improve this code to produce consistent results for a project submission on free code camp, I\'m preferably looking for a method to solve these type of problems ra