Bugs
def div(num1, num2): try: return (num1/num2) except ZeroDivisionError: print("Division failed: division by zero") return None except TypeError: print("Division failed: integers and floats accepted only") return None
- def div(num1, num2):
return(num1 / num2)- try:
- return (num1/num2)
- except ZeroDivisionError:
- print("Division failed: division by zero")
- return None
- except TypeError:
- print("Division failed: integers and floats accepted only")
- return None
test.assert_equals(div(10, 0), None) test.assert_equals(div("10", 2), None) test.assert_equals(div(50, 10), 5) test.assert_equals(div(10, 5), 2) test.assert_equals(div(100, 10), 10) test.assert_equals(div(64, 8), 8) test.assert_equals(div(30, 6), 5) test.assert_equals(div(55, 5), 11) test.assert_equals(div(144, 12), 12) test.assert_equals(div(66, 6), 11) test.assert_equals(div(132, 12), 11) test.assert_equals(div(1, 1), 1)
- test.assert_equals(div(10, 0), None)
- test.assert_equals(div("10", 2), None)
- test.assert_equals(div(50, 10), 5)
- test.assert_equals(div(10, 5), 2)
- test.assert_equals(div(100, 10), 10)
- test.assert_equals(div(64, 8), 8)
- test.assert_equals(div(30, 6), 5)
- test.assert_equals(div(55, 5), 11)
- test.assert_equals(div(144, 12), 12)
- test.assert_equals(div(66, 6), 11)
- test.assert_equals(div(132, 12), 11)
- test.assert_equals(div(1, 1), 1)