Oct-10-2020, 05:37 PM
when you import the fraction module, you can instantiate a Fraction instance:
from fractions import Fraction as frac
a = frac(1,3)
b = frac(1,6)
c = a+b
print('sum is {0}'.format©)
1/2
But I would like have the reducible form of 3/6
Is there a switch I'm missing in rationals, fractions, etc? that would cause the fraction to NOT be put in irreducible form?
Tnx
from fractions import Fraction as frac
a = frac(1,3)
b = frac(1,6)
c = a+b
print('sum is {0}'.format©)
1/2
But I would like have the reducible form of 3/6
Is there a switch I'm missing in rationals, fractions, etc? that would cause the fraction to NOT be put in irreducible form?
Tnx