-
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 py-feed-animals #622
base: master
Are you sure you want to change the base?
Conversation
app/main.py
Outdated
def __init__(self, name: str, | ||
appetite: int, | ||
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.
Place each argument in a separate line
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.
Okay, thank you)
app/main.py
Outdated
total_food_points = sum(animal.feed() | ||
for animal in animals if animal.is_hungry) | ||
return total_food_points |
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.
simplify it
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 | |
) |
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.
Cool, thank you.
app/main.py
Outdated
print("The slippers delivered!") | ||
|
||
|
||
def feed_animals(animals: list) -> int: |
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.
add additional typehint for list inner objects like list[YOUR_VALUE_TYPE]
for example: list that contains string elements has typehint list[str]
No description provided.