# I need help with mad Maxer: redemption

I cant beat mad maxer redemption I just cant get it I keep on getting infinite loops, have something wrong with my code, or the hero just stands there

``````while True:
weakestFriend = None
leastHealth = 9999
friendIndex = 0
# Find which friend has the lowest health.
friends = hero.findFriends()
while friendIndex > len(friends):
friend = friends(friendIndex)
if friend:
if friend.health < leastHealth and friend.type != "archer":
leastHealth = weakestFriend
weakestFriend = friend
friendIndex += 1
# Tell the weakest friends to go home first.
if weakestFriend:
hero.say('Hey ' + weakestFriend.id + ', go home!')
``````

Try replacing the `'`(apostrophes) s with `"`(quotation/speech marks).

sorry it didn’t work my hero just sat around

Can you send a screenshot of your hero’s equipment? Thanks

@Rachel699 I dont think that is the problem. @Vincent_Mainer said his hero was just standing still

I would advise looking at the hints. They help a lot in this level

Hi Vincent_Mainer,

Firstly, have a look at this line:

``````while friendIndex > len(friends):
``````

You’ve set friendIndex at 0 to start, and there are 4 friends. Will this ever be true?

Also this line:

``````                friendIndex += 1
``````

needs to run every time the ‘while friendIndex’ loop runs. At the moment it only runs if both the if statements are true. What do you change to make this happen?

Post again if you need more help.

Jenny

I have tried everything you guys said to do but a villager just dies on the sixth line, it gets stuck on defining the friends and the weakest villager dies

``````while True:
weakestFriend = None
leastHealth = 9999
friendIndex = 0
# Find which friend has the lowest health.
friends = hero.findFriends()
while friendIndex < len(friends):
friend = (friendIndex)
if friend:
if friend.health < leastHealth and friend.type !=  "archer":
if friend.Health < leastHealth:
leastHealth = friend.health
friendIndex += 1
# Tell the weakest friends to go home first.
if weakestFriend:
hero.say("Hey " + weakestFriend.id + ", go home!")

``````

Hi, @Vincent_Mainer, could you send me a link to this level please?

@Anonym, you can find a level by putting in codecombat.com/play/level/name, replacing name with the name of the level (spaces go in as dashes). Eg codecombat.com/play/level/mad-maxer-redemption

@Vincent_Mainer, you’ve changed these lines. Put them back to what they were before!

Jenny