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 #1803

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

Solution #1803

wants to merge 1 commit into from

Conversation

ryabchinskyam
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.

Great job on implementing the Distance class with all the required functionalities! 🎉 While there are some minor issues with type annotations, they don't affect the functionality of your code. For future improvements, consider updating the return type annotations to reflect the actual return types, such as using -> bool for comparison methods and -> Distance for arithmetic methods. 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! ✨

def __init__(self, km: int) -> None:
self.km = km

def __str__(self) -> None:

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 string, but the return type annotation is None. It should be -> str.

def __str__(self) -> None:
return f"Distance: {self.km} kilometers."

def __repr__(self) -> None:

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 string, but the return type annotation is None. It should be -> str.

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

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

Choose a reason for hiding this comment

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

The __add__ method should return a Distance object, but the return type annotation is None. It should be -> Distance.

else:
raise TypeError("Unsupported operand type for +")

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

Choose a reason for hiding this comment

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

The __iadd__ method should return a Distance object, but the return type annotation is None. It should be -> Distance.

raise TypeError("Unsupported operand type for +")
return self

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

Choose a reason for hiding this comment

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

The __mul__ method should return a Distance object, but the return type annotation is None. It should be -> Distance.

else:
raise TypeError("Unsupported operand type for /")

def __lt__(self, other: "Distance | int | float") -> None:

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 boolean, but the return type annotation is None. It should be -> bool.

else:
raise TypeError("Unsupported operand type for <")

def __gt__(self, other: "Distance | int | float") -> None:

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 boolean, but the return type annotation is None. It should be -> bool.

else:
raise TypeError("Unsupported operand type for >")

def __eq__(self, other: "Distance | int | float") -> None:

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 boolean, but the return type annotation is None. It should be -> bool.

else:
return False

def __le__(self, other: "Distance | int | float") -> None:

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 boolean, but the return type annotation is None. It should be -> bool.

def __le__(self, other: "Distance | int | float") -> None:
return self.__lt__(other) or self.__eq__(other)

def __ge__(self, other: "Distance | int | float") -> None:

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 boolean, but the return type annotation is None. It should be -> bool.

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