-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #818
base: master
Are you sure you want to change the base?
Solution #818
Conversation
app/main.py
Outdated
def __str__(self) -> str: | ||
return f"Distance: {self.km} kilometers." | ||
|
||
def __add__(self, other: Distance) -> Distance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other can be int or float as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typehinting everywhere
app/main.py
Outdated
def __mul__(self, other: Distance) -> Distance: | ||
return Distance(self.km * other) | ||
|
||
def __truediv__(self, other: Distance) -> Distance: | ||
return Distance(round(self.km / other, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other can be only int or float, not Distance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is related to these 2 cases only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
No description provided.