From my experience 80% pass this level with WRONG code - i’m checking the leader board if the given advice is followed but usually i had wasted my time typing answers…
This will never ever work as intended.
if lowestFriend and paladin.canCast("heal"):
hero.command(paladin, "cast", "heal", lowestFriend)
if enemy:
hero.command(paladin, "attack", enemy)
How to write the function and why the above code will not work you’ll find using search:
grim determination @xython with:images