commit 2869b809f62f260eee8ba7a8a74a031ade5dd048 Author: Mario Alegre Date: Sat Dec 12 18:59:46 2020 -0500 first commit diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/python/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/python/FracAndDec.py b/python/FracAndDec.py new file mode 100644 index 0000000..ac41dda --- /dev/null +++ b/python/FracAndDec.py @@ -0,0 +1,11 @@ +import decimal +import fractions + +class Dec(decimal.Decimal): + def __Fraction__(self): + return self.__new__(self.numerator) / self.__new__(self.denominator) + + getcontext = decimal.getcontext + +class Frac(fractions.Fraction): + pass