Sarven Shepherd help?

Hi! I can’t seem to beat this level with the following code with 827 health. Any suggestions? Thank you!

loop:
    enemies = self.findEnemies()
    enemyIndex = 0
    
    while enemyIndex < len(enemies):    
        enemy = enemies[enemyIndex]
        if enemy.type != "sand-yak":
       
            while enemy.health >0:
                if self.isReady("cleave") and self.distanceTo(enemy) <10:
                    self.cleave(enemy)
                else:
                    self.attack(enemy)
        enemyIndex = enemyIndex +1
        pass
    
    self.moveXY(40, 32)

Well, it is not the code. That works fine. I have less health but a different sword . . . So try again without cleaving if that doesn’t work get different a sword.