Library tactician [NEED HELP]

Ok so my soldiers go out and kill but one keeps on dying half way through cause they dont get healed. Another issue is that it says that the command defend is not defined

def summonSoldier():
    if > hero.costOf("soldier"):

# Soldiers spread out in a circle and defend.
def commandSoldier(soldier, soldierIndex, numSoldiers):
    angle = Math.PI * 2 * soldierIndex / numSoldiers
    defendPos = {"x": 41, "y": 40}
    defendPos.x += 10 * Math.cos(angle)
    defendPos.y += 10 * Math.sin(angle)
    hero.command(soldier, "defend", defendPos);

# Find the strongest target (most health)
def findStrongestTarget():
    strongest = None
    strongestHealth = 0
    enemyIndex = 0
    enemies = hero.findEnemies()
    while enemyIndex < len(enemies):
        enemy = enemies[enemyIndex]
    if ( > 60):
        hero.command(soldier, "defend", defendPos)
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# If the strongestTarget has more than 15 health, attack that target. Otherwise, attack the nearest target.
def commandArcher(archer):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

archerTarget = None

while True:
    # If archerTarget is defeated or doesn't exist, find a new one.
    if not archerTarget or <= 0:
        # Set archerTarget to be the target that is returned by findStrongestTarget()
        archerTarget = findStrongestTarget()
    friends = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    archers = hero.findByType("archer")
    for i, soldier in enumerate(soldiers):
        commandSoldier(soldier, i, len(soldiers));
    # use commandArcher() to command your archers
    for i, archer in enumerate(archers):


Hi, there are are few problems here.

You haven’t finished the function yet, it should return the strongest, like you did in desert levels.

This is right, but you need to put it in the commandSoldier function, instead of findStrongestTarget(), because that’s where you define the defendPos variable, and that’s what the function’s for.
Thirdly, you need to add the

# If the strongestTarget has more than 15 health, attack that target.

I hope this helps,