How to print/show an expression in rational number form in python
<p>I've been developing a Tkinter app and at some label i need to put formula that should look like a rational number(expression1/expression2, like a numerator and denominator and a bar between them). I did some digging and couldnt find anything related to it. Any suggestions on how this can be done ?</p>

<p>I even couldnt find anything on printing a fraction in a rational number format on the console. I oonly care about the looks and no calculation will be made with it, its just a label</p>

<pre><code>print '%s'%Fraction(1.5)
&gt;&gt;&gt; '3/2'
</code></pre>

<p>See: <a href="https://pymotw.com/2/fractions/" rel="nofollow">https://pymotw.com/2/fractions/</a></p>

python math tkinter