Mad Maxer: Redemption - not finding weakestFriend

Mad Maxer: Redemption

I know my code is bad. I’ve been struggling with array’s. I’ve been trying to learn how to code for almost a year now and arrays have killed my progress every time.
I’ve been reviewing the other levels, reading the forum and I’ve saved my code so I can look at what I’ve done on other levels. This is a mixture of my code from two other levels: ‘mad maxer strikes back’ and ‘sarven savior’.
details=xyz [/details didn’t work inside the 3 back ticks so i put that code after the back ticks so if it doesn’t line up I didn’t know how else to post without having all the code showing. Any advise on how to do that properly will be helpful as well.
I am a subscriber but I posted here because maybe this topic will help others as well.

    weakestFriend = None  
    leastHealth = 9999    
    # This should create an array of all friends
    friends = self.findFriends()
    # Array indices start at 0
    friendIndex = 0

    # Loop over each name in the array.
    # The len() function gets the length of the list.
    while friendIndex < len(friends):
        # Use square brackets to get a name from the array.
        friend = friends[friendIndex]
        # Increment the index to get the next name from the array.
        friendIndex += 1
        if < leastHealth:
   = leastHealth
            weakestFriend = friend
        # Tell your friend to go home. Use + to connect two strings.
        if friend:
            if friend.type != "archer":
                self.say('Hey ' + + ', go home!')

It looks like you need to switch the bit changing the variable leastHealth around.

You want to change leastHealth to if is smaller than current leastHealth. You’re telling it to do it backwards.

thanks. that did it.
I have been changing so many things around. I changed that at some point and back and again.
so, once the code doesn’t have any errors I have to hit submit to run the new code? It seemed like I would make changes and hit run and the changes didn’t really take affect but if I would hit submit then I would see something new happen??? I thought submit would only change the computer simulation and not necessarily have anything to do with running my code differently from the ‘run’ button.

Hm, I’m no expert but “run” should be enough to check for code errors. When you submit some things gets randomized depending on the type of level but that shouldn’t matter here.