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

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

Conversation

yurafrits13102001
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.

Review Summary

Great job on implementing the Animal, Herbivore, and Carnivore classes! Your code meets the task requirements and constraints effectively. Here are some key points and suggestions for improvement:

  • Correct Implementation:

    • The Animal class has the necessary attributes (name, health, hidden) with default values, and the alive class attribute correctly maintains a list of all alive animals.
    • The Herbivore class properly inherits from Animal and includes a hide method that toggles the hidden attribute.
    • The Carnivore class inherits from Animal and includes a bite method that decreases a Herbivore's health by 50, provided the Herbivore is not hiding.
    • The __repr__ method in the Animal class ensures the correct output format when printing Animal.alive.
  • Critical Issue:

    • Ensure that the update_alive method is called on the Animal class itself whenever an animal's health changes to zero or below. This is crucial for maintaining the correct list of alive animals.
  • Style and Efficiency:

    • You've adhered to style guidelines by using class names to access class attributes, using type annotations, and employing string interpolation.

While there are minor issues, the decision to approve your Pull Request is made to help you move forward with your learning. Please review the comments and address any critical issues in future implementations to avoid similar problems. Keep up the good work and continue improving your code! 🚀

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

Comment on lines +29 to +30
if prey.health <= 0:
Animal.update_alive()

Choose a reason for hiding this comment

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

The update_alive method should be called on the Animal class, not on an instance. The current implementation is correct in this regard, but ensure that the method is called whenever an animal's health changes to zero or below.

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