Sort by

recency

|

419 Discussions

|

  • + 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)
    
  • + 0 comments
    T = int(input())
    for i in range(T):
        try:
            nums = list(map(int, input().split()))
            a = nums[0]
            b = nums[1]
            div = a//b
        except ZeroDivisionError as e:
            print(f"Error Code: {e}")
        except ValueError as n:
            print(f"Error Code: {n}")
        else:
            print(div)