diff --git a/src/main/py/fractions.py b/src/main/py/fractions.py index e78ca03..2470caf 100644 --- a/src/main/py/fractions.py +++ b/src/main/py/fractions.py @@ -24,4 +24,7 @@ def addFractions(num1, denom1, num2, denom2): def multiplyFractions(num1, denom1, num2, denom2): result_num = num1 * num2 result_denom = denom1 * denom2 - return reduceFraction(result_num, result_denom) \ No newline at end of file + return reduceFraction(result_num, result_denom) + +def divideFractions(num1, denom1, num2, denom2): + return multiplyFractions(num1, denom1, denom2, num2) \ No newline at end of file diff --git a/src/test/py/test_fractions.py b/src/test/py/test_fractions.py index 61be4bd..b776a68 100644 --- a/src/test/py/test_fractions.py +++ b/src/test/py/test_fractions.py @@ -33,6 +33,9 @@ class fractions(unittest.TestCase): def test_multiply_fractions_1_by_5_and_5_by_3_should_be_1_by_3(self): self.assertEqual(multiplyFractions(1,5,5,3), (1,3)) + def test_divide_fractions_10_by_3_and_20_by_9_should_be_3_by_2(self): + self.assertEqual(divideFractions(10,3,20,9), (3,2)) + if __name__ == '__main__': unittest.main()