# Help on Brittle Morale Python \[Solved\]

**URL:** <https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379>\
**Category:** Level Help\
**Created:** [September 7, 2021, 2:08pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379 "2021-09-07T14:08:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_legendary\_pro19](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/the_legendary_pro19/32/31950_2.png) [@The\_legendary\_pro19](https://discourse.codecombat.com/u/The_legendary_pro19)\
**Post date:** [September 7, 2021, 2:08pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/1 "2021-09-07T14:08:59Z")

</div>

this is my code:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/e/0/e0a6fe0c8c1b875dd78e2aa60832bea91d336b28.jpeg)

---

<div class="post-metadata">

**Author:** ![The\_legendary\_pro19](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/the_legendary_pro19/32/31950_2.png) [@The\_legendary\_pro19](https://discourse.codecombat.com/u/The_legendary_pro19)\
**Post date:** [September 7, 2021, 2:09pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/2 "2021-09-07T14:09:58Z")

</div>

formatted code:

```python
# You have one arrow. Make it count!

# This should return the enemy with the most health.
def findStrongestEnemy(enemies):
    strongest = None
    strongestHealth = 0
    enemyIndex = 0
    # While enemyIndex is less than the length of enemies:
    while enemyIndex < len(enemies):
        # Set an enemy variable to enemies[enemyIndex]
        enemy = enemies[enemyIndex]
        # If enemy.health is greater than strongestHealth
        if enemy.health > strongestHealth:
            # Set `strongest` to enemy
            # Set strongestHealth to enemy.health
            enemy.health = strongestHealth
        # Increment enemyIndex
        enemyIndex += 1
    return strongest
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
    hero.say(leader)

```

---

<div class="post-metadata">

**Author:** ![Aya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aya/32/42680_2.png) [@Aya](https://discourse.codecombat.com/u/Aya)\
**Post date:** [September 7, 2021, 3:30pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/3 "2021-09-07T15:30:00Z")

</div>

> [@The\_legendary\_pro19](#):
>
> `enemy.health = strongestHealth`

I think it should be the opposite way, `strongestHealth = enemy.health`  
And take care of this comment, you are returning strongest which is None, you need to redefine it:

> [@The\_legendary\_pro19](#):
>
> `# Set `strongest` to enemy`

---

<div class="post-metadata">

**Author:** ![The\_legendary\_pro19](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/the_legendary_pro19/32/31950_2.png) [@The\_legendary\_pro19](https://discourse.codecombat.com/u/The_legendary_pro19)\
**Post date:** [September 7, 2021, 3:38pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/4 "2021-09-07T15:38:00Z")

</div>

thanks so much ![]()

---

<div class="post-metadata">

**Author:** ![Aya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aya/32/42680_2.png) [@Aya](https://discourse.codecombat.com/u/Aya)\
**Post date:** [September 7, 2021, 3:39pm UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/5 "2021-09-07T15:39:06Z")

</div>

No problem (20chars)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [September 8, 2021, 3:39am UTC](https://discourse.codecombat.com/t/help-on-brittle-morale-python-solved/30379/6 "2021-09-08T03:39:43Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
