Python program to Get Division by Zero Error

x = float(input("Insert first number: "))
y = float(input("Insert second number: "))
try:
 z = x/y
except ZeroDivisionError:
 print("Error! Number not divisible by zero...")
else:
 print(z)

 

 

 

Output:

 

Insert first number: 12
Insert second number: 0
Error! Number not divisible by zero...

 

Insert first number: 0
Insert second number: 12
0.0

   

 

Subscribe For Daily Updates