Protect and Serve Explain

I don’t understand how to use the for loop here

# Protect the workers and animals!

# Defend these two positions:
defend = []
defend[0] = { "x": 98, "y": 28 }
defend[1] = { "x": 84, "y": 7 }

soldiers = []

friends = hero.findFriends()
for index in range(len(friends)):
    friend = friends[index]
    if friend.type == "soldier":
        soldiers.append(friend)
    else:
        # Defend the workers:
        defend.append(friend)

while True:
    # Use a for-loop to assign each soldier to a corresponding defend[] target
    # Use command(soldier, "defend", thang) or command(soldier, "defend", position)
    
    pass

Java code

Hi,welcome to the discourse! @Pparhit
Let me think, is this Java(I thought it was Python lol)

1 Like

Well, in the while loop, you didn’t add anything

What?
@ineedhelpwithcoding

nothing sorry i didn’t see the part of the msg

This is not Java, it’s Python

3 Likes

sorry I meant to say Python

Use the hints, they tell you how to use a for loop.