length, so how many indexes there are in the list.
Also, you should increment soldierIndex
inside the while loop, otherwise it will just stay as this way soldierIndex += 1
You are trying to loop over the list of the soldiers you have over here, so you command soldier after soldier in this loop.
This line says, as long as soldierIndex is less than the length of the list of soldiers you have, so for instance, you summoned 5 soldiers, so as long as soldierIndex is less than 5, do something
Now this something you are trying to do, is specifying who do you want to command, the first time the while loop runs, soldierIndex equals to 0, and let’s say there are 5 soldiers, so soldier is the number or index that we currently have, which is 0 at the moment inside the list of soldiers. so soldier is 0th index in the soldiers list, as for the beginning, then you are commanding this soldier that you defined to move to a certain XY position.
Now the line that I told you to add of incrementing soldierIndex changes which soldier you are commanding, so when you add 1 to soldierIndex, the soldier that you are commanding changes. So now that we added one to soldierIndex, it becomes 1, so soldier becomes the 1st index in the soldiers list. So now you are commanding the second soldier in you list to move to an XY position. And so on the process continues until soldierIndex equals to the number of indexes in the soldiers list, which is in this example 5, so here the while loop breaks and you move on with your code.
Note: indexes in Python start at 0 not 1
And as for this yes, its place it fine.
Hope this helps a bit to clear things out. 