Sort by

recency

|

420 Discussions

|

  • + 0 comments
    def Errors_exception(T):
        for _ in range(T):
            data = input().split()
            try:
                print(int(data[0])//int(data[1]))
            except ZeroDivisionError as ze:
                print(f"Error Code: {ze}")
            except ValueError as ve:
                print(f"Error Code: {ve}")
    
    
    
    if __name__ == '__main__':
        T = int(input())
        Errors_exception(T)
    
  • + 0 comments

    def expFunc(in_arg1,in_arg2): try: return int(in_arg1)//int(in_arg2) except ZeroDivisionError as e: return (f"Error Code: {e}") except ValueError as v: return (f"Error Code: {v}")

    n=int(input()) for i in range(n): a, b =input().split() print(expFunc(a,b))

  • + 0 comments

    t=int(input()) for _ in range(t): try: a,b=input().split() a,b=int(a),int(b)

        print(a//b)
    except ZeroDivisionError as e:
        print("Error Code:",e)
    except ValueError as d:
        print("Error Code:",d)
    
  • + 0 comments
    # Not sure what I did wrong maybe format ? : 
    
    test = int(input()) # enter testcase
    vals = input().split() # [1,0,2,1,3,4]
    clean = list(map(int,vals))
    l = 0
    r  = 1
    
    try:
      while r < len(clean):
        print(clean[l]//clean[r])
        r+=2
        l+=2
    except ZeroDivisionError as e:
        print(f"Error Code:",e)
        print(test)
    except ValueError as v:
        print(f"Error code:",v)
       
       
    
  • + 0 comments
    T = int(input().strip())
    for i in range(T):
        try:
            a, b = input().strip().split()
            result = int(int(a) / int(b))
        except ZeroDivisionError as e:
            print(f"Error Code: integer division or modulo by zero")
        except ValueError as ve:
            print(f"Error Code: {ve}")
        else:
            print(result)