Python Convert Float to Ratio || Python
In this we are going to see a basic program to convert float to ratio in Python Programming Language.



from fractions import Fraction

def convert(num):
    return Fraction(num).limit_denominator()

print("Ratio Of 0.33333333 Is : ",convert(0.3333333333333333))
print("Ratio Of 1.2 Is : ",convert(1.2))

# Code By DHIRAJ SHELKE


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post