If repeating fraction exists , insert parentheses .
if ( repeating ) : res += " ) " NEW_LINE INDENT x = res [ : index ] NEW_LINE x += " ( " NEW_LINE x += res [ index : ] NEW_LINE res = x NEW_LINE DEDENT