Skip to content
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' #1702

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

'Solution' #1702

wants to merge 1 commit into from

Conversation

Andriy521
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your implementation of the Distance class is well-done and meets the task requirements! 🎉 The class handles arithmetic operations and comparisons effectively. While there is a minor suggestion to improve the type hints for better clarity and to remove some unnecessary else statements, these do not impact the functionality. Keep up the great work, and consider these suggestions for future improvements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

def __repr__(self) -> str:
return f"Distance(km={self.km})"

def __add__(self, other: int) -> "Distance":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

km=self.km + other
)

def __iadd__(self, other: int) -> "Distance":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

self.km = self.km + other
return self

def __mul__(self, other: int) -> "Distance":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

def __mul__(self, other: int) -> "Distance":
return Distance(km=self.km * other)

def __truediv__(self, other: int) -> "Distance":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

def __truediv__(self, other: int) -> "Distance":
return Distance(km=round(self.km / other, 2))

def __lt__(self, other: int) -> bool:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

else:
return self.km < other

def __gt__(self, other: int) -> bool:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

else:
return self.km > other

def __eq__(self, other: int) -> bool:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

else:
return self.km == other

def __le__(self, other: int) -> bool:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

else:
return self.km <= other

def __ge__(self, other: int) -> bool:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the other parameter should include both Distance and int, as the method is designed to handle both types. Consider changing it to Union[Distance, int].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants