[SOLVED]Toil and trouble help python


#1
# Ogre Witches have some unpleasant surprises ready for you.

# Define a chooseTarget function which takes a friend argument
# Returns a target to attack, depending on the type of friend.
# Soldiers should attack the witches, archers should attack nearest enemy.
def chooseTarget(friend):
    enemies = friend.findEnemies()
    enemy = friend.findNearest(enemies)
    witches = self.findByType("witch", enemies)
    witch = friend.findNearest(witches)
    if friend and friend.type is "soldier" and enemy and witch and witch.health > 0:
            friend.command(friend, "attack", witch)
    if friend and friend.type is "archer" and enemy:
        self.command(friend, "attack", enemy)
loop:
    friends = self.findFriends()
    for friend in friends:
        # Use your chooseTarget function to decide what to attack.
        chooseTarget(friend)


#2

:eyes:
:tongue:
Help please.


#3

Never mind :disappointed_relieved::disappointed_relieved:


#4

The biggest mistakes are the smallest.


#5


#6

yay I finally did it!!


#7

you asked your friend to command him/herself.