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

implemented #1336

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

Conversation

SviatoslavTataryn
Copy link

-class Animal
-class Herbivore
-class Carnivore

-class Animal
-class Herbivore
-class Carnivore
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 class and its subclasses! 🎉 Your code meets the core requirements, and the functionality is well-implemented. While there are a few minor improvements suggested, such as adding type annotations for clarity, these do not impact the functionality. Keep up the good work, and consider incorporating the feedback to enhance your code quality further! 😊

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

app/main.py Outdated
@@ -1 +1,26 @@
# write your code here
class Animal:
alive = []

Choose a reason for hiding this comment

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

The alive list is a class variable, which is appropriate for tracking all instances of Animal. Ensure that this list is managed carefully to avoid potential issues with object references, especially when instances are deleted or go out of scope.


class Herbivore(Animal):
def hide(self):
self.hidden = not self.hidden

Choose a reason for hiding this comment

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

The hide method toggles the hidden state of the Herbivore. This is correct, but ensure that the logic for hiding is consistent with the intended behavior of the application.


class Carnivore(Animal):
def bite(self, animal):
if isinstance(animal, Herbivore) and not animal.hidden:

Choose a reason for hiding this comment

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

The bite method correctly checks if the animal is an instance of Herbivore and not hidden before reducing its health. This logic is appropriate for the intended functionality.

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