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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #1632

wants to merge 2 commits into from

Conversation

Dizatvarska
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! 🎉 Your code meets the task requirements and constraints effectively. Just a small note: for compatibility with Python versions prior to 3.10, consider using isinstance(other, (int, float)) for type checking instead of int | float. Keep up the good work! 😊

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

app/main.py Outdated
self.km = km

def __add__(self, other: Union["Distance", int, float]) -> "Distance":
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
)

def __iadd__(self, other: Union["Distance", int, float]) -> "Distance":
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
return Distance(round(self.km / other, 2))

def __lt__(self, other: Union["Distance", int, float]) -> bool:
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
return self.km < other.km

def __gt__(self, other: Union["Distance", int, float]) -> bool:
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
return self.km > other.km

def __eq__(self, other: Union["Distance", int, float]) -> bool:
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
return self.km == other.km

def __le__(self, other: Union["Distance", int, float]) -> bool:
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

app/main.py Outdated
return self.km <= other.km

def __ge__(self, other: Union["Distance", int, float]) -> bool:
if isinstance(other, int | float):

Choose a reason for hiding this comment

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

The use of int | float for type checking is incorrect for Python versions prior to 3.10. Use isinstance(other, (int, float)) instead.

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