-
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
Solution #1272
base: master
Are you sure you want to change the base?
Solution #1272
Conversation
app/main.py
Outdated
total_food = 0 | ||
for animal in animals: | ||
total_food += animal.feed() | ||
return total_food |
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.
use sum
method for that
app/main.py
Outdated
lion = Animal("Lion", 25) | ||
lion.print_name() | ||
food_points = lion.feed() | ||
print(food_points) | ||
print(lion.is_hungry) | ||
print(lion.feed()) | ||
|
||
cat = Cat("Cat") | ||
cat.print_name() | ||
cat.feed() | ||
|
||
cat2 = Cat("Cat", False) | ||
print(cat2.feed()) | ||
cat2.catch_mouse() | ||
|
||
dog = Dog("Dog") | ||
dog.print_name() | ||
dog.feed() | ||
|
||
dog2 = Dog("Dog", False) | ||
print(dog2.feed()) | ||
dog2.bring_slippers() | ||
|
||
print(feed_animals([cat2, lion, 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.
remove your own checking
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.
ok
No description provided.