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

added solution #913

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

Conversation

MAFIOZNIK1999
Copy link

No description provided.

app/main.py Outdated
Comment on lines 21 to 24
name = "{Name: " + str(self.name)
health = ", Health: " + str(self.health)
hidden = ", Hidden: " + str(self.hidden) + "}"
return name + health + hidden

Choose a reason for hiding this comment

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

explicitly defining the string that should be returned will improve the readability
Just use f-strings and parentheses to split into lines

app/main.py Outdated
class Carnivore(Animal):

@staticmethod
def bite(animal: Union[Herbivore, Carnivore]) -> None:

Choose a reason for hiding this comment

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

You can use Animal class for annotations here, it will include Herbivore, Carnivore and other classes, that could be created in the future

app/main.py Outdated

@staticmethod
def bite(animal: Union[Herbivore, Carnivore]) -> None:
if animal.hidden is False and isinstance(animal, Herbivore):

Choose a reason for hiding this comment

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

You can use not in the condition
if not animal.hidden

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.

Great 💪

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