From 999fde1c513a2c50c432acc321e4c8d31f7eb7fd Mon Sep 17 00:00:00 2001 From: lafrite Date: Fri, 17 Jan 2014 18:10:38 +0100 Subject: [PATCH] Add -f for Fraction --- fraction.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fraction.py b/fraction.py index 289df7e..9d0f28c 100644 --- a/fraction.py +++ b/fraction.py @@ -126,6 +126,9 @@ class Fraction(object): steps += ans_frac.simplify() return steps + + def __neg__(self): + return [Fraction(-self._num,self._denom)] def __mul__(self, other): if type(other) == Fraction: