Sort by

recency

|

439 Discussions

|

  • + 0 comments
    num_test_cases = int(input())
    
    for _ in range(num_test_cases):
        try:
            a, b = map(int, input().split())
            result = a // b
            print(result)
        except Exception as error:
            print(f"Error Code: {error}")
    
  • + 0 comments
    t = int(input())
    for i in range(t):
        a,b = input().split(' ')
        try:
            print(int(a)//int(b))
        except Exception as e:
            print("Error Code:", e)
    
  • + 0 comments

    n = int(input()) for i in range(n): try: a,b = input().split() result = int(a)//int(b) except ZeroDivisionError: print(f"Error Code: integer division or modulo by zero") except ValueError as e: print(f"Error Code: {e}") else: print(a)

            only one test case is passed remaining two cases are failed can anyone explain what is the solution 
    
  • + 0 comments

    That explanation of handling exceptions is really clear, much like how Virtual Pet Consultation Services Slough ensures unexpected issues are managed smoothly with the right guidance.

  • + 0 comments

    Here is the most cleaner and simple code:-

    test_cases = int(input())
    test_cases_list = [input().split(" ") for _ in range(test_cases)]
        
    for num in test_cases_list:
        try:
            print(int(num[0]) // int(num[1]))
        except Exception as e:
            print(f"Error Code: {e}")