-
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
Feeding #1316
base: master
Are you sure you want to change the base?
Feeding #1316
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.
Thank you for your hard work on this Pull Request! 😊 However, there are a few critical issues that need to be addressed to ensure the code functions correctly:
-
Constructor Initialization: The
Cat
andDog
classes are missing theappetite
argument in theirsuper().__init__
calls. TheCat
class should pass an appetite of 3, and theDog
class should pass an appetite of 7. This is essential for the proper functioning of theAnimal
class constructor. -
Return Value in
print_name
Method: Theprint_name
method should return a string instead of printing it. This change is necessary to meet the expected functionality.
Please make these changes to align with the core requirements of the task. Once updated, your code will be in great shape! Keep up the good work, and don't hesitate 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
|
||
|
||
class Cat(Animal): | ||
def __init__(self, name: str, is_hungry: bool = True) -> None: |
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 super().__init__
call is missing the appetite
argument required by the Animal
class constructor. You should pass the default appetite value for a Cat
(3) to the super().__init__
call.
app/main.py
Outdated
|
||
|
||
class Dog(Animal): | ||
def __init__(self, name: str, is_hungry: bool = True) -> None: |
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 super().__init__
call is missing the appetite
argument required by the Animal
class constructor. You should pass the default appetite value for a Dog
(7) to the super().__init__
call.
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 addressing the previous issues in your code! 🎉 Here are a few points to consider for further improvement:
-
Incorrect Argument in Cat Initialization: Ensure that the
Cat
instance is initialized with an integer forappetite
instead of a boolean. This is crucial for the code to function correctly. -
Redundant Attribute Initialization: In both
Cat
andDog
classes, theappetite
andis_hungry
attributes are being set twice. Since they are already initialized in thesuper().__init__
call, you can remove the redundant initialization.
Overall, your code is in good shape and meets the task requirements. Keep up the good work and make sure to address these points in future iterations to enhance your coding skills. Remember, learning from these experiences will help you grow as a developer. 🚀
✨ 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, appetite: int = 3, is_hungry: bool = True) -> None: | ||
super().__init__(name, appetite, is_hungry) | ||
self.appetite = appetite |
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 appetite
and is_hungry
attributes are already initialized in the super().__init__
call. You don't need to set them again in the Cat
class constructor.
def __init__(self, name: str, appetite: int = 7, is_hungry: bool = True) -> None: | ||
super().__init__(name, appetite, is_hungry) | ||
self.appetite = appetite | ||
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.
The appetite
and is_hungry
attributes are already initialized in the super().__init__
call. You don't need to set them again in the Dog
class constructor.
feed_num.append(animal.feed()) | ||
return sum(feed_num) | ||
|
||
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.
The Cat
instance is being initialized with a boolean value False
instead of an integer for appetite
. This should be an integer value, such as 3
.
No description provided.