Brittle Morale help


#1

here is my code what is wrong???

def findStrongestEnemy(enemies):
    strongest = None
    strongestHealth = 0
    enemyIndex = 0
    while enemyIndex < len(enemies):
        enemy = enemies[enemyIndex]
        if enemy.health > strongestHealth:
            strongestHealth = enemy.Health
        enemyIndex += 1
    return strongest
    enemies = hero.findEnemies()
    leader = findStrongestEnemy(enemies)
    if leader:
        hero.say(leader)


#2

I also wanted to know what does code combat meant by highlighting the code?


#3

You defined a function:

def findStrongestEnemy(enemies):
    strongest = None # function start
# some code here
        hero.say(leader) # function end 

Where do you call it?


#4

you placed the code return strongest while strongest was still None. there is no strongest. you also put this line in the def findStrongestEnemy(enemies):

hint

the strongest is one of the enemies. also call this function outside def findStrongestEnemy(enemies):


#5

so do I have to put the strongest = enemy?


#6

yes. (wat not 20 yet)


#7

what do you mean wat not 20 yet


#8

You need 20 characters to post.