Zoo Keeper Help!(Python)

Try this:

for j in range(len(friends)):
        point = points[j]
        friend = friends[j]
        enemy =  friend.findNearestEnemy()
        if friend and enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
            self.command(friend, "attack", enemy)
         elif friend:
            self.command(friend, "move", point)

Shortly, this way of codding is bad:

if something
     attack
if something_else
     move

This is good:

if something 
    attack
elif something_else
    move
5 Likes