Mixed unit tactics pyhton

This function has a few problems.
Firstly, why are you looping through your friends array twice? You do for friend in friends, then for i in range(len(friends)). You only want the for i in range(len(friends)). The first for loop is unnecessary.
Secondly, posi is incorrectly defined (this is actually very difficult, so I understand you having difficulty with it). At the moment, you are doing defendPoints[i] % len(defendPoints). Remember that defendPoints[i] is actually a coordinate, like {“x”: 44, “y”: 55}. You can’t use the % operator on it. Instead, you want to use i by itself, and divide that by len(defendPoints).
For more on % (modulo), you can read the post I wrote earlier, also about modulo, albeit in a different level:

Danny