I have to calculate the ratio between 0.000857179311146189 and 0.026955533883055983 but am unsure how to do this other than by dividing the two numbers. Is it possible to calculate this with the result in the form 0.001714 : 0.053912
I have to calculate the ratio between 0.000857179311146189 and 0.026955533883055983 but am unsure how to do this other than by dividing the two numbers. Is it possible to calculate this with the result in the form 0.001714 : 0.053912
Using the fractions
module:
from fractions import Fractionnum1 = Fraction(0.000857179311146189)
num2 = Fraction(0.026955533883055983)ratio = Fraction(num1, num2).limit_denominator()print(f"{ratio.numerator / 10**6} : {ratio.denominator / 10**6}")
# 0.027671 : 0.870164