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

Implement animal classes #1293

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

Conversation

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

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

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

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)

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)

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")

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.

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