programming-examples/python/Math/Convert a float to ratio.py

3 lines
93 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
from fractions import Fraction
value = 4.2
print(Fraction(value).limit_denominator())