CodeEval Challenge..written in Python