Grim Determination Paladins not healing

Help me! My hero.command(paladin, "cast", "heal", lhealth) line is not working properly somehow and I do not know how to fix it.
here is my code:

# Your goal is to protect Reynaldo

# Find the paladin with the lowest health.
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "paladin":
        if < lowestHealth and < friend.maxHealth:
            lowestHealth =
            lowestFriend = friend
    return lowestFriend

def commandPaladin(paladin):
    # Heal the paladin with the lowest health using lowestHealthPaladin()
    # You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
    # Paladins can also shield: command(paladin, "shield")
    # And don't forget, they can attack, too!
    if paladin.canCast('heal'):
        lhealth = lowestHealthPaladin()
        if lhealth and < 525 and paladin.type == "paladin":
            hero.command(paladin, "cast", "heal", lhealth)  
    if < 200:
        hero.command(paladin, "shield")
        enemy = paladin.findNearestEnemy()
        if enemy:
            hero.command(paladin, "attack", enemy)

def commandPeasant(peasant):
    coin = peasant.findNearestItem()
    if ( == 'Hector' and coin.pos.y >= 38) or ( == 'Rose' and coin.pos.y <= 38):
        hero.command(peasant, "move", coin.pos)

def commandGriffin(griffin):
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.command(griffin, "attack", enemy)

def commandFriends():
    # Command your friends.
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "peasant":
        elif friend.type == "griffin-rider":
        elif friend.type == "paladin":

while True:
    # Summon griffin riders!
    while >= hero.costOf('griffin-rider'):

Hi @Moonkak3 welcome to the CodeCombat discourse.
You’re right that the casting heal isn’t working.
I think it’s something to do with this:

if < 200:
    hero.command(paladin, "shield")

I would get rid of that anyway, I don’t see the point of making them shield. It just makes them die slower without doing anything to stop it.
I would also make the paladins defend their own position. It sounds a bit odd, but it keeps them from running away and they attack nicely in a little formation.
(hero.command(paladin, "defend", paladin))
A problem you will encounter at this point is the healing section. To fix it definde lhealth outside the if statement and check all the conditions on the first if statement.
Once I did that I won with the bonus, and none of my paladins or my griffin-riders died.
I hope this helps,

tysm! i will try this right now