as currently implemented, it is correct on a test like assert try_float_cash("$ 45.29")==45.29
right now, the behavior is incorrect on the following test:
assert try_float_cash("$1,345.29")==1345.29
def try_float_cash(x):
''' get a `$` out of what's supposed to be a number
TODO: fix incorrect behavior: e.g. `assert try_float_cash("$1,345.29")==1345.29` '''
try:
return float('.'.join(re.findall(r'\d+', x)))
except TypeError:
return x
except ValueError:
return x```
This function needs attention.
as currently implemented, it is correct on a test like
assert try_float_cash("$ 45.29")==45.29
right now, the behavior is incorrect on the following test:
assert try_float_cash("$1,345.29")==1345.29