-
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
123 #1674
base: master
Are you sure you want to change the base?
123 #1674
Conversation
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.
Great job on implementing the Distance
class with all the required functionalities! 🎉 The code meets the task requirements and constraints effectively. While there are some minor issues with return type annotations for certain methods, these do not impact the overall functionality. Correcting these annotations will enhance code clarity and correctness. Keep up the good work and continue refining your skills! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def __init__(self, km: float) -> None: | ||
self.km = km | ||
|
||
def __str__(self) -> None: |
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.
The __str__
method should return a str
, not None
. Update the return type annotation to str
.
def __str__(self) -> None: | ||
return f"Distance: {self.km} kilometers." | ||
|
||
def __repr__(self) -> None: |
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.
The __repr__
method should return a str
, not None
. Update the return type annotation to str
.
raise ZeroDivisionError("Cannot divide by zero.") | ||
return NotImplemented | ||
|
||
def __lt__(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.
The __lt__
method should return a bool
, not Distance
. Update the return type annotation to bool
.
return self.km < other | ||
return NotImplemented | ||
|
||
def __gt__(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.
The __gt__
method should return a bool
, not Distance
. Update the return type annotation to bool
.
return self.km > other | ||
return NotImplemented | ||
|
||
def __eq__(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.
The __eq__
method should return a bool
, not Distance
. Update the return type annotation to bool
.
return self.km == other | ||
return NotImplemented | ||
|
||
def __le__(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.
The __le__
method should return a bool
, not Distance
. Update the return type annotation to bool
.
return self.km <= other | ||
return NotImplemented | ||
|
||
def __ge__(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.
The __ge__
method should return a bool
, not Distance
. Update the return type annotation to bool
.
No description provided.