Browse Source

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

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

4
src/main/py/fractions.py

@ -9,8 +9,8 @@ def dec_to_frac(dec_number):
def reduceFraction(num, denom):
gcdOfFraction = gcd(num, denom)
num /= gcdOfFraction
denom /= gcdOfFraction
num = divide(num, gcdOfFraction)
denom = divide(denom, gcdOfFraction)
return (num, denom)
def addFractions(num1, denom1, num2, denom2):

Loading…
Cancel
Save