Browse Source

refactoring: Avoided Duplication of Code in Function multiplyFractions by utilizing the already implemented functions

remotes/origin/feature/feature-fractions
fdai7764 11 months ago
parent
commit
5066fe695d
  1. 4
      src/main/py/fractions.py

4
src/main/py/fractions.py

@ -26,8 +26,8 @@ def addFractions(num1, denom1, num2, denom2):
return reduceFraction(result_num, denom1) return reduceFraction(result_num, denom1)
def multiplyFractions(num1, denom1, num2, denom2): def multiplyFractions(num1, denom1, num2, denom2):
result_num = num1 * num2
result_denom = denom1 * denom2
result_num = multiply(num1, num2)
result_denom = multiply(denom1, denom2)
return reduceFraction(result_num, result_denom) return reduceFraction(result_num, result_denom)
def divideFractions(num1, denom1, num2, denom2): def divideFractions(num1, denom1, num2, denom2):

Loading…
Cancel
Save