-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
solved 2 #1443
base: master
Are you sure you want to change the base?
solved 2 #1443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! But you can make it simplier, without getter and setter.
There was a problem hiding this 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
, Herbivore
, and Carnivore
classes! 🎉 Your code meets the task requirements and constraints, and you've done well with the class structure, inheritance, and method implementations. Just a couple of minor improvements: consider removing the redundant isinstance
check in the Carnivore
class and use the health
property method instead of directly accessing _health
. Keep up the great work! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
return ( | ||
"{" | ||
f"Name: {self.name}, " | ||
f"Health: {self.health}, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The health
property should be accessed using self.health
instead of self._health
to ensure the getter method is used.
class Carnivore(Animal): | ||
@staticmethod | ||
def bite(other: Herbivore) -> None: | ||
if isinstance(other, Herbivore): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isinstance
check is redundant because the other
parameter is already typed as Herbivore
. You can remove this check.
No description provided.