We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Errors and Exceptions
- Exceptions
- Discussions
Exceptions
Exceptions
+ 0 comments Simplest method
#number of test cases test_cases = int(input()) for i in range(test_cases): a,b = input().split(" ") try: ans = int(a)//int(b) print(ans) except Exception as e: print(f'Error Code: {e}')
+ 0 comments N = int(input()) for _ in range(N): isOkay = True a, b = input().split() try: i = int(a) j = int(b) except ValueError as e: isOkay = False print("Error Code:", e) if isOkay: try: print(int(int(a)/int(b))) except ZeroDivisionError: print("Error Code:", 'integer division or modulo by zero')
+ 1 comment for _ in range(int(input())): try: a, b = list(map(int, input().split())) try: print(int(a//b)) except ZeroDivisionError as e: print("Error Code:", e) except ValueError as e: print("Error Code:", e)
+ 0 comments N = int(input()) for _ in range(N): b = input().split() try : res = int(b[0]) // int(b[1])
print(res)
except ValueError as e: print("Error Code:", e) except ZeroDivisionError as e: print("Error Code:" , e )
+ 0 comments n = int(input())
for i in range(n): try: a, b = map(int, input().split()) print(a//b) except ZeroDivisionError as e: print("Error Code: integer division or modulo by zero") except ValueError as e: print("Error Code:", e)
Load more conversations
Sort 360 Discussions, By:
Please Login in order to post a comment