Help on Brittle Morale Python [Solved]

this is my code:

formatted code:

# 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 is greater than strongestHealth
        if > strongestHealth:
            # Set `strongest` to enemy
            # Set strongestHealth to
   = strongestHealth
        # Increment enemyIndex
        enemyIndex += 1
    return strongest
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:

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

1 Like

thanks so much

1 Like

No problem (20chars)

1 Like

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