It is clearly written in the FAQ how to
How do people still manage to use block-quotes?
Sorry for the little rant, here is your problem:
soldiers = self.findFriends() #Is currently empty, no friends spawned yet
soldierIndex = 0
soldier = soldiers[soldierIndex] #Tries to get the first entry of an empty list, soldier = None
self.summon("soldier") #If you would now call findFriends(), you would get a list with one entry
self.command(soldier, "attack", enemy) #As soldier is None your code fails
You should solve the level as intended. There is a line in the default-code that says "I should summon something here!"
Use this place to summon your soldiers, it works best.