I have a two lists with values that I want to compare. If the value can be converted to a float, I want to compare the floats else I just want to compare the values as strings. How can I make that distinction to check whether a value can be converted to float or not?
Share
The easiest way should be to just try to convert them to floats, and if that fails, fall back to a compare on strings: