title: How to convert a decimal number into fraction?
body: <p>I was wondering how to convert a decimal into a fraction in its lowest form in Python.</p>
  
  <p>For example:</p>
  
  <pre><code>0.25  -&gt; 1/4
  0.5   -&gt; 1/2
  1.25  -&gt; 5/4
  3     -&gt; 3/1
  </code></pre>