Desert world / Lurkers / Solved

All is fixed :smiley:

# findEnemies returns a list of all your enemies.
# Only attack shamans. Don't attack yaks!

enemies = hero.findEnemies()
enemyIndex = 0

# Wrap this section in a while loop to iterate all enemies.
# While the enemyIndex is less than the length of enemies
while enemyIndex < len(enemies):
    enemy = enemies[enemyIndex]
    if enemy.type == 'shaman':
        while enemy.health > 0:
            hero.attack(enemy)
    # Remember to increment enemyIndex
    enemyIndex += 1

You don’t need that break at the end.

Delete the break. put enemyIndex in the while loop.

Thank you the code is working now : D

Congrats on beating the Level! Could you please check the checkmark next to a post to show that this topic is solved?

To the post that lead you to the solution of course :smiley:

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