a=ln(3x-1)/y def except_test(x,y): try:
#检查是否为0或复数 if y<=0: print("不好意思,请输入大于0的数字") result=math.log(3*x-1)/y return result except ValueError as e: print(f"报错信息为:{e}") except Exception as e: print(f"异常信息为:{e}") try : x=float(input("请输入第一个值:")) y=float(input("请输入第二个值:")) result1=except_test(x,y) if result1 is not None: print(f"表达式 ln(3x-1)/y 的结果为: {result1}") except ValueError as e: print("请输入有效的数字:") except Exception as e: print(f"An unexpected error occurred: {e}")