-
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' #564
base: master
Are you sure you want to change the base?
'Solution' #564
Conversation
app/main.py
Outdated
print(f"Eating {self.appetite} food points...") | ||
self.is_hungry = False | ||
return self.appetite | ||
else: |
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 redundant "else"
app/main.py
Outdated
print("The slippers delivered!") | ||
|
||
|
||
def feed_animals(list_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]
app/main.py
Outdated
sum_result = 0 | ||
for elem in list_animals: | ||
if elem.is_hungry: | ||
sum_result += elem.appetite | ||
elem.feed() | ||
|
||
return sum_result |
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 generator expression to do it
No description provided.