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

solved 2 #1443

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

solved 2 #1443

wants to merge 1 commit into from

Conversation

Danylo-Ok
Copy link

No description provided.

Copy link

@ruslanyemets ruslanyemets left a comment

Choose a reason for hiding this comment

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

Good job! But you can make it simplier, without getter and setter.

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 Animal, Herbivore, and Carnivore classes! 🎉 Your code meets the task requirements and constraints, and you've done well with the class structure, inheritance, and method implementations. Just a couple of minor improvements: consider removing the redundant isinstance check in the Carnivore class and use the health property method instead of directly accessing _health. Keep up the great work! 😊

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

return (
"{"
f"Name: {self.name}, "
f"Health: {self.health}, "

Choose a reason for hiding this comment

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

The health property should be accessed using self.health instead of self._health to ensure the getter method is used.

class Carnivore(Animal):
@staticmethod
def bite(other: Herbivore) -> None:
if isinstance(other, Herbivore):

Choose a reason for hiding this comment

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

The isinstance check is redundant because the other parameter is already typed as Herbivore. You can remove this check.

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.

3 participants