Brittle morale help [PYTHON]

help please my hero aint movin

# 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 = strongest
            strongestHealth = enemy.health
        # Increment enemyIndex
        enemyIndex += 1
    return strongest

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

wait lemme try summoning @JustALuke

i believe this is supposed to be enemy

and I think these need to be switched (like strongest=enemy)

2 Likes

(i’m just guessing tho, I’m comparing your code to others)

edit: Luke has liked my previous message, so i’m assuming it’s that lol

1 Like

i finished already sorry

1 Like

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