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

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

Conversation

AntonKrinichnyi
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 are a few critical issues that need to be addressed before we can approve the Pull Request. The typos in the hide method of the Herbivore class and the bite method of the Carnivore class need to be corrected to ensure the code functions as expected. Additionally, the logic in the bite method should be revised to handle hidden victims appropriately. Once these issues are resolved, the code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 😊

✨ 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
class Herbivore(Animal):
def hide(self) -> bool:
self.hidden = not self.hidden
return self.hiden

Choose a reason for hiding this comment

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

There is a typo in the return statement. It should be self.hidden instead of self.hiden.

app/main.py Outdated
def bite(self, victim: Herbivore) -> bool:
if isinstance(victim, Carnivore):
print('Carnivore cannot bite by another carnivore!')
elif not victim.hiden:

Choose a reason for hiding this comment

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

There is a typo here. It should be victim.hidden instead of victim.hiden.

app/main.py Outdated
Comment on lines 47 to 48
elif victim.hidden:
victim.health = 100

Choose a reason for hiding this comment

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

The logic here seems incorrect. If the victim is hidden, their health should not be reset to 100. Consider revising this logic to reflect the intended behavior when a hidden victim is bitten.

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 effort on your submission! 🎉 Your code meets most of the task requirements, but there are a few critical issues that need to be addressed to enhance functionality and adhere to the task constraints:

  1. Carnivore Class - Bite Method: The bite method currently checks if the victim is a Carnivore, which seems incorrect. It should check if the victim is a Herbivore since carnivores typically prey on herbivores. Additionally, ensure that the method returns a boolean indicating whether the bite was successful.

  2. Animal Class - Alive Attribute: Ensure that the Animal.alive attribute only contains living animals. The current implementation does not handle the case where an animal is initialized with health less than or equal to zero, which could lead to dead animals being added to Animal.alive.

  3. Printing Alive Animals: The print_alive method should match the required output format. It currently returns a list of dictionaries but does not print them in the specified format.

  4. Code Style: Make sure all string literals use double quotes to adhere to the style guide.

Your decision to approve this Pull Request is to help you move forward with your learning journey. However, it's crucial to address these issues in future iterations to avoid similar problems. Keep up the good work, and use this feedback to refine your skills and improve your code! 🚀

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


class Carnivore(Animal):
def bite(self, victim: Herbivore) -> bool:
if isinstance(victim, Carnivore):

Choose a reason for hiding this comment

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

The condition isinstance(victim, Carnivore) seems incorrect for the bite method. The method should check if the victim is a Herbivore, not a Carnivore, since a carnivore should be able to bite herbivores, not other carnivores. Consider revising this condition.

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