Exception Error Handling in Python

Source code :

x=input("enter the value of x:")
y=input("enter the value of y:")
try:
 div=int (x)/ int (y)
 print(div)
except Exception as e:
 print("error:" +str (e))
 y = input("enter the new value of y:")
 div=int (x)/int (y)
 print(div)

Output :

enter the value of x:10
enter the value of y:0
error:division by zero
enter the new value of y:5
2

Output :


                

Comments :