Question

What is the simplest method to convert variable like

x=7.36/1

into rational fraction like

x=736/100
Was it helpful?

Solution

from fractions import Fraction

Fraction(7.36/1).limit_denominator()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top