def canBeNumeric(inStr):
 try:
  float(inStr)
  return True
 except Exception:
  return False

def canBeNumeric ( inStr ) : try : float ( inStr ) return True except Exception : return False
determines whether the input can be converted to a float (using a try: float) .