Could you please review this item - from a return type point of view this piece of code is not the greatest.
Depending on the outcome of float or int evaluation, the function returns either a number or a string.
That makes a sanity check of the function’s return value significantly more difficult than it needs to be.
Can the instructions be changed such that the return of the function is consistently numeric, please. Zero or larger as valid returns, numbers less than zero indicating an error condition has been detected - ignoring the fact that depending on the input, the return can either be an integer, or a float.