-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #714
base: master
Are you sure you want to change the base?
Solution #714
Conversation
app/main.py
Outdated
for item in Animal.alive: | ||
if item.name == animal.name: |
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.
Really is it possible that other hp can change?
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.
do I need to check in some other way? the list always has 1 predator and 1 herbivore, can there be more?
tests/test_main.py
Outdated
@@ -15,7 +15,7 @@ def test_animal_class(): | |||
|
|||
|
|||
def test_animal_constructor(): | |||
lion = Animal("Lion King") | |||
lion = Animal("Lion King", ) |
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.
don't change this file
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.
I don't know how I did it)
app/main.py
Outdated
if (animal.hidden or animal not in animal.alive | ||
or not isinstance(animal, Herbivore)): | ||
return | ||
animal.health -= 50 | ||
if animal.health <= 0: | ||
Animal.alive.remove(animal) |
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 this and get rid of return
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.
I changed it, but I'm not sure that it's better
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.
Good job!
No description provided.