Don’t know what I did wrong.
# 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 have to put the if
statement inside the while enemyIndex < len(enemies)
Thank you for your help if I didn’t mess up my other account by making it a teacher I wouldn’t have to do this again.
You know you can convert your other account to a normal one by contacting team@codecombat.com and tell them to deteacher you
I did that now.
I hope it works I gave them me email that they can get in contact with me
Why does this not work.
return #Commented out to stop infinite loop.
# 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