input: 
  from typing import Union
  
  def eval_expr(expr: str) -> Union[int, float]:
      """Takes a string containing a numerical expression and returns the result.
      >>> eval_expr("2+3")
      5
      >>> eval_expr("10*2.5")
      25.0
      >>> eval_expr("7/2")
      3.5
      """
      return eval(expr)
  
output:     try:
          result = eval(expr)
          if isinstance(result, (int, float)):
              return result
          else:
              raise ValueError("Expression does not evaluate to a number")
      except Exception as e:
          raise ValueError(f"Invalid expression: {e}")