a = 1.0 b = float(input()) #请从键盘输入一个数,强制转换为浮点型 try: c = a/b print(f"c={c}") except: print("b is zero...") finally: print("program end...")
【无标题】异常处理
最新推荐文章于 2024-07-16 19:26:54 发布
a = 1.0 b = float(input()) #请从键盘输入一个数,强制转换为浮点型 try: c = a/b print(f"c={c}") except: print("b is zero...") finally: print("program end...")