num1 = int(input("请输入num1的值"))
num2 = int(input("请输入num2的值"))
if num2 != 0:
print(num1 / num2)
练习-判断除数为零
最新推荐文章于 2023-09-30 16:32:06 发布
本文探讨了在Python编程中如何处理除数为零的情况,通过实例讲解了如何预防和捕获ZeroDivisionError异常,对于测试工程师在编写测试用例时尤其重要。
摘要由CSDN通过智能技术生成