https://codecombat.com/play/level/brittle-morale?
I need help, I did everything it asked of me and I still does not work.
# You have one arrow. Make it count!
# This should return the enemy with the most health.
def findStrongestEnemy(enemies):
strongest = None
strongestHealth = 0
enemyIndex = 0
# While enemyIndex is less than the length of enemies:
while enemyIndex < len.enemies:
# Set an enemy variable to enemies[enemyIndex]
enemy = enemies[enemyIndex]
# If enemy.health is greater than strongestHealth
if enemy.health > strongestHealth:
# Set `strongest` to enemy
# Set strongestHealth to enemy.health
strongestHealth = enemy.health
# Increment enemyIndex
enemyIndex += 1
return strongest
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
hero.say(leader)
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
hero.say(leader)
ah youve got it half right please format correctly by copying your code with ctrl c then click the </> button and paste it
did it, now what do I do?
Oh, I’m sorry, I can’t help you.Haven’t passed it myself.I’ll summon some guys to help you.
@Eric_Tang , @098765432123 , @enPointe77.
First of all
its supposed to be (len(enemies)):
then you have
read the first # ligne
Why are you summoning me? If you haven’t passed it, I certainly haven’t.
I dont understand this last part. You put two
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
hero.say(leader)
just keep one