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

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

Solution #1300

wants to merge 2 commits into from

Conversation

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


It looks like there's a small logical issue in the feed_animals function that needs to be addressed before we can approve the pull request. The function currently adds the animal's appetite to food_points even if the animal is not hungry, which is not the intended behavior. Instead, you should use the return value of animal.feed() to update food_points only when the animal is actually fed. Once this is corrected, your code will be in great shape! Keep up the good work and feel free to reach out if you have any questions. 😊

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

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

app/main.py Outdated
Comment on lines 43 to 44
animal.feed()
food_points += animal.appetite

Choose a reason for hiding this comment

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

The feed_animals function adds the animal's appetite to food_points even if the animal is not hungry. This is incorrect because the feed method already returns the appetite if the animal is fed. You should use the return value of animal.feed() to update food_points.

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, Cat, and Dog classes with appropriate inheritance and method overriding! 🐾 Your code meets the task requirements and constraints effectively. Here are a few points to consider for improvement:

  • Type Annotation in feed_animals Function: While the function is implemented correctly, enhancing the parameter type annotation by using List[Animal] from the typing module would improve code readability and maintainability. This would look like def feed_animals(animals: List[Animal]) -> int:.

Your solution is approved to help you move forward with your learning journey. Please review the comments to refine your code further. Addressing these minor issues will enhance your coding skills and prevent similar problems in the future. Keep up the great work and continue learning from your experiences! 🚀

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

print("The slippers delivered!")


def feed_animals(animals: list) -> int:

Choose a reason for hiding this comment

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

The feed_animals function should specify the type of objects in the list. Consider using List[Animal] from the typing module for better type hinting, i.e., def feed_animals(animals: List[Animal]) -> int:.

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