Skip to content

Commit

Permalink
Language edit
Browse files Browse the repository at this point in the history
  • Loading branch information
KateFinegan authored Dec 19, 2023
1 parent c271630 commit 551cce9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-magic-methods/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, value, unit="m"):
self.value = value
self.unit = unit.lower()

def to_metre(self):
def to_meter(self):
return self.value * type(self)._multiples[self.unit]

def __add__(self, other):
Expand All @@ -20,7 +20,7 @@ def __sub__(self, other):
return self._compute(other, "-")

def _compute(self, other, operator):
operation = eval(f"{self.to_metre()} {operator} {other.to_metre()}")
operation = eval(f"{self.to_meter()} {operator} {other.to_meter()}")
cls = type(self)
return cls(operation / cls._multiples[self.unit], self.unit)

Expand Down

0 comments on commit 551cce9

Please sign in to comment.