Python Exception Handling | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python Exception Handling

I want to get the exception of ZeroDivisionError: as 'integer division or modulo by zero' but I get as 'division by zero'.How can I get that? can anyone explain?

12th Oct 2021, 9:23 AM
hasintha hewage
hasintha hewage - avatar
4 Answers
12th Oct 2021, 9:59 AM
Ipang
0
Can you share that code?
12th Oct 2021, 9:27 AM
Atul [Inactive]
0
a=int(input()) b=[] for i in range(a): b.append(list(input().split())) try: print(int(int(b[i][0])/int(b[i][1]))) except Exception as e: print( "Error Code:", e)
12th Oct 2021, 9:49 AM
hasintha hewage
hasintha hewage - avatar