fractions
fractions — Rational numbers
Source code: Lib/fractions.py
The fractions
module provides support for rational number arithmetic.
A Fraction instance can be constructed from a pair of integers, from another rational number, or from a string.
-
class fractions.Fraction(numerator=0, denominator=1)
-
class fractions.Fraction(other_fraction)
-
class fractions.Fraction(float)
-
class fractions.Fraction(decimal)
-
class fractions.Fraction(string)
-
The first version requires that numerator