Stores a rational fraction as a numerator and denominator. Fractions
can be output as strings and also read in from strings (use
Fraction(string=<string>), or just Fraction(<string>)).
The format used is "i", where i is an integer if the
fraction is an exact integer, or "i n/d", where i is the
integer part, n the numerator and d the denominator.
|
|
__init__(self,
numerator=0,
denominator=1,
string=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
simplified(self)
Returns a simplified version of this fraction without modifying the
instance. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__,
__sizeof__,
__subclasshook__
|