Add 2 fractions works!
This commit is contained in:
@@ -46,6 +46,24 @@ class MOFraction(MO):
|
||||
self._denominator = denominator
|
||||
self.negative = negative
|
||||
|
||||
@property
|
||||
def numerator(self):
|
||||
""" Get the numerator. If self is negative, getting the opposite of the _numerator
|
||||
"""
|
||||
if self.negative:
|
||||
return Tree("-", None, self._numerator)
|
||||
|
||||
return self._numerator
|
||||
|
||||
@property
|
||||
def denominator(self):
|
||||
return self._denominator
|
||||
|
||||
def inverse(self):
|
||||
""" return the inverse fraction """
|
||||
return MOFraction(self._denominator,
|
||||
self._numerator,
|
||||
self.negative)
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
|
Reference in New Issue
Block a user