-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement animal classes #1293
base: master
Are you sure you want to change the base?
Implement animal classes #1293
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.
Great job on implementing the Animal class and its subclasses! 🐾 While there are a few minor redundancies, like the repeated object creations and unnecessary attribute assignments, these don't impact the core functionality of your code. Keep up the good work, and consider refining these areas for cleaner code in the future. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
class Cat(Animal): | ||
def __init__(self, name: str, is_hungry: bool = True): | ||
super().__init__(name, appetite=3) | ||
self.is_hungry = is_hungry |
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.
Redundant assignment: The 'is_hungry' attribute is already set in the superclass constructor. This line is unnecessary and can be removed.
class Dog(Animal): | ||
def __init__(self, name: str, is_hungry: bool = True): | ||
super().__init__(name, appetite=7) | ||
self.is_hungry = is_hungry |
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.
Redundant assignment: The 'is_hungry' attribute is already set in the superclass constructor. This line is unnecessary and can be removed.
print(dog2.feed()) # 0 | ||
dog2.bring_slippers() # "The slippers delivered!" | ||
|
||
cat = Cat("Cat", False) |
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.
Redundant object creation: The 'cat' object is created again with the same name and state as before. Consider removing this line if the intention is not to reset the 'cat' object.
dog2.bring_slippers() # "The slippers delivered!" | ||
|
||
cat = Cat("Cat", False) | ||
lion = Animal("Lion", 25, True) |
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.
Redundant object creation: The 'lion' object is created again with the same name and state as before. Consider removing this line if the intention is not to reset the 'lion' object.
|
||
cat = Cat("Cat", False) | ||
lion = Animal("Lion", 25, True) | ||
dog = Dog("Dog") |
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.
Redundant object creation: The 'dog' object is created again with the same name and state as before. Consider removing this line if the intention is not to reset the 'dog' object.
No description provided.