[Tutor] fractions
Gregor Lingl
glingl@mail.rg16.asn-wien.ac.at
Thu, 26 Apr 2001 15:17:59 +0200
--------------5E254BDC9F658F00391A326D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Katharine Stoner schrieb:
> Hi all, Does anyone know of a function to convert fractions to
> decimals and decimals to fractions? -Cameron
Dear Cameron,
You may have a look at
http://www.lowerstandard.com/python/ACMsolutions.html
which contains two solutions ( 332gsl.py and 332gl.py) to the problem
posed on:
http://acm.uva.es/problemset/v3/332.html which is the heavier part of
your question.
For the other part you may use the expression 1.0*p/q to convert
the fraction p/q into a float.
Have a lot of fun ;-)
Gregor Lingl
--------------5E254BDC9F658F00391A326D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
<p>Katharine Stoner schrieb:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Hi
all,</font></font> <font face="Arial"><font size=-1>Does anyone know
of a function to convert fractions to decimals and decimals to fractions?</font></font> <font face="Arial"><font size=-1>-Cameron</font></font> </blockquote>
<p><br>Dear Cameron,
<p>You may have a look at
<p> <a href="http://www.lowerstandard.com/python/ACMsolutions.html">http://www.lowerstandard.com/python/ACMsolutions.html</a>
<p>which contains two solutions ( 332gsl.py and 332gl.py) to the problem
posed on:
<p> <a href="http://acm.uva.es/problemset/v3/332.html">http://acm.uva.es/problemset/v3/332.html</a>
which is the heavier part of your question.
<p>For the other part you may use the expression 1.0*p/q to convert
<br>the fraction p/q into a float.
<p>Have a lot of fun ;-)
<p>Gregor Lingl
</body>
</html>
--------------5E254BDC9F658F00391A326D--