- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathexceptions.py
More file actions
Latest commit
24 lines (23 loc) · 631 Bytes
/
Copy pathexceptions.py
File metadata and controls
24 lines (23 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Exceptions
# Handle errors detected during execution.
#
# https://www.hackerrank.com/challenges/exceptions/problem
#
n=int(input())
for_inrange(n):
a, b=input().split()
try:
a=int(a)
exceptValueError:
print("Error Code: invalid literal for int() with base 10: '{}'".format(a))
continue
try:
b=int(b)
exceptValueError:
print("Error Code: invalid literal for int() with base 10: '{}'".format(b))
continue
try:
print(a//b)
exceptZeroDivisionError:
print("Error Code: integer division or modulo by zero")
continue