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 py-feed-animals #622

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

Conversation

IvDyriv
Copy link

@IvDyriv IvDyriv commented Aug 18, 2023

No description provided.

app/main.py Outdated
Comment on lines 2 to 4
def __init__(self, name: str,
appetite: int,
is_hungry: bool = True) -> None:

Choose a reason for hiding this comment

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

Place each argument in a separate line

Copy link
Author

Choose a reason for hiding this comment

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

Okay, thank you)

@IvDyriv IvDyriv requested a review from olena-hul August 18, 2023 12:02
app/main.py Outdated
Comment on lines 46 to 48
total_food_points = sum(animal.feed()
for animal in animals if animal.is_hungry)
return total_food_points

Choose a reason for hiding this comment

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

simplify it

Suggested change
total_food_points = sum(animal.feed()
for animal in animals if animal.is_hungry)
return total_food_points
return sum(
animal.feed() for animal in animals if animal.is_hungry
)

Copy link
Author

Choose a reason for hiding this comment

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

Cool, thank you.

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


def feed_animals(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]

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.

4 participants