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

created parent class Animal and two inherit classes #1424

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

Conversation

AlArt99
Copy link

@AlArt99 AlArt99 commented Dec 9, 2024

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.

Great job on implementing the class hierarchy for Animal, Herbivore, and Carnivore! 🎉 Your code meets the task requirements and constraints effectively. While there are a couple of minor issues, such as the shared alive list and the __str__ method being a class method, these do not significantly impact the functionality. Keep up the good work, and consider the feedback for future improvements! 😊

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

Comment on lines +28 to +29
@classmethod
def __str__(cls) -> str:

Choose a reason for hiding this comment

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

The __str__ method should not be a class method. It is typically an instance method that returns a string representation of an instance. Consider removing the @classmethod decorator and adjusting the method accordingly.

@@ -2,0 +1,41 @@
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, meaning it is shared among all instances of Animal. If the intention is to track all living animals across all instances, this is fine. However, if each instance should have its own list of 'alive' animals, consider making it an instance variable instead.

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