Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Fractions/MyFraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def __sub__(self, fraction):
return answer

def __mul__(self, fraction):
answer = "Calculate the answer. The answer will be a fraction"
self.mulNum = self.numerator * fraction.numerator
self.mulDen = self.denominator * fraction.denominator
answer = MyFraction(self.mulNum, self.mulDen)
return answer

def __truediv__(self, fraction):
Expand Down
4 changes: 2 additions & 2 deletions Fractions/Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def main():
#subResult = fraction2 - fraction1
#print("Subtraction result was: " + subResult + ". The correct answer is: 0/0")

#multResult = fraction1 * fraction2
#print("Multiplication result was: " + multResult + ". The correct answer is: 1/4")
multResult = fraction1 * fraction2
print("Multiplication result was: " + str(multResult) + ". The correct answer is: 1/4")

#divResult = fraction1 / fraction2
#print("Division result was: " + divResult + ". The correct answer is: 1/1")
Expand Down