除數爲0,程序異常的處理

import random while True: def exp_exception(x,y): try: a=int(x/y) print(「a=」, a) return a except Exception: print(「程序出現異常,異常信息:被除數爲0」) cs_input=int(input(「請輸入被除數」)) exp_exception(random.randint(10000)
相關文章
相關標籤/搜索