How about adding rational fraction to Python?

Anand Patil anand.prabhakar.patil at gmail.com
Sat Mar 1 13:29:23 EST 2008


Not sure if this is common knowledge yet but Sympy,
http://code.google.com/p/sympy, has a rational type.

In [2]: from sympy import *

In [3]: Rational(21,4)
Out[3]: 21/4

In [4]: Rational(21,4)+Rational(3,4)
Out[4]: 6



More information about the Python-list mailing list