Sort by

recency

|

436 Discussions

|

  • + 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}")
    
  • + 0 comments

    n = int(input()) for _ in range(n): try: a,b =input().split() print(int(a)//int(b)) except ZeroDivisionError as e: print("Error Code:",e) except ValueError as e: print("Error Code:",e)

  • + 0 comments
    T = int(input())
    if T in range(0, 10):
        p = [ (input()) for i in range(T)]
        for _ in p:
            try:
                result = int(_[0])//int(_[-1])     
            except ZeroDivisionError:
                print("Error Code: integer division or modulo by zero")
            except ValueError:
                if _[0].isdigit():
                    s = _[-1]
                else:
                    s = _[0]
                print("Error Code: invalid literal for int() with base 10: '{}'".format(s))
            else:
                print(result)
    
  • + 0 comments
    inputs = int(input())
    for _ in range(inputs):
        a , b = input().split()
        try:
            print(int(a)// int(b))
    
        except ZeroDivisionError as e :
            print('Error Code:', e)
        
        except ValueError as e:
            print('Error Code:', e)