Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Level Help: Brittle Morale (Python)

Hello, I’ve been stuck on this level for a while, and I was trying to find out what to do. It keeps saying that is not a variable after it accepted it as on before.

Someone tell me what’s going on and how I can fix it.

Here’s the 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]
        # If is greater than strongestHealth
        if > strongestHealth:
            # Set `strongest` to enemy
            # Set strongestHealth to
            enemy= strongest
            strongestHealth =
        # Increment enemyIndex
        enemyIndex +=1
    return strongest

enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:

Howdy and welcome to the forum!

Line 12, take a closer look at the comment, then take a good look at line 14…

1 Like

Thanks, I’m welcome to be here.

I appreciate the nudge @dedreous!

may the ogres crumble beneath your mighty blade. :smiley:

1 Like