-
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
Complite #1652
base: master
Are you sure you want to change the base?
Complite #1652
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
Something went wrong while processing the review.
[CODE: 3]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
Something went wrong while processing the review.
[CODE: 3]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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! 🎉 While there are a few minor type hinting issues, they don't impact the functionality of your code. It's a good practice to specify return types accurately, so consider updating them for clarity. Keep up the good work and happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,3 +1,60 @@ | |||
class Distance: | |||
# Write your code here | |||
pass | |||
def __init__(self, km: any) -> 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 type hint any
for the km
parameter should be more specific. Consider using int
or float
if those are the expected types.
def __repr__(self) -> str: | ||
return f"Distance(km={self.km})" | ||
|
||
def __add__(self, other: any) -> 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 return type for the __add__
method should not be None
. It should return a new Distance
object, so the return type should be Distance
.
elif isinstance(other, (int, float)): | ||
return Distance(self.km + other) | ||
|
||
def __iadd__(self, other: any) -> 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 return type for the __iadd__
method should not be None
. It should return self
, so the return type should be Distance
.
self.km += other | ||
return self | ||
|
||
def __mul__(self, other: any) -> 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 return type for the __mul__
method should not be None
. It should return a new Distance
object, so the return type should be Distance
.
if isinstance(other, (int, float)): | ||
return Distance(self.km * other) | ||
|
||
def __truediv__(self, other: any) -> 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 return type for the __truediv__
method should not be None
. It should return a new Distance
object, so the return type should be Distance
.
if isinstance(other, (int, float)) and other != 0: | ||
return Distance(round(self.km / other, 2)) | ||
|
||
def __lt__(self, other: any) -> 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 return type for the __lt__
method is missing. It should return a bool
.
No description provided.