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' #816

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

Conversation

aleksandra-prognimak
Copy link

No description provided.

Copy link

@LiudmylaKulinchenko LiudmylaKulinchenko left a comment

Choose a reason for hiding this comment

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

Well done 🐣

app/main.py Outdated
Comment on lines 41 to 44
def __le__(self, other: Distance | int | float) -> bool:
return self.km <= self.get_km(other)

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

Choose a reason for hiding this comment

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

You can rewrite these two methods using previously created magic methods
(<= is the same as not >)

app/main.py Outdated
Comment on lines 42 to 45
return not self.__gt__(other)

def __ge__(self, other: Distance | int | float) -> bool:
return not self.__lt__(other)

Choose a reason for hiding this comment

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

U can just use operands here instead of calling method directry

Copy link

@LiudmylaKulinchenko LiudmylaKulinchenko left a comment

Choose a reason for hiding this comment

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

Stunning 💎

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