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

'Solution' #564

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

'Solution' #564

wants to merge 2 commits into from

Conversation

usKos
Copy link

@usKos usKos commented Jul 14, 2023

No description provided.

app/main.py Outdated
print(f"Eating {self.appetite} food points...")
self.is_hungry = False
return self.appetite
else:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove redundant "else"

app/main.py Outdated
print("The slippers delivered!")


def feed_animals(list_animals: list) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add additional typehint for list inner objects like list[YOUR_VALUE_TYPE]
for example: list that contains string elements has typehint list[str]

app/main.py Outdated
Comment on lines 45 to 51
sum_result = 0
for elem in list_animals:
if elem.is_hungry:
sum_result += elem.appetite
elem.feed()

return sum_result

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use generator expression to do it

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