Level "trojan-yeti" seems to be correct... but it does not work

Can somebody have a look, why my Code does not work? It seems to be correct.

# This function returns a friendly unit by the name.

* List item

def findFriendByName(name):
    friends = hero.findFriends()
    for i in range(len(friends)):
        if friends[i].id == name:
            return friends[i]
    return None

# The sergeant wrote the list of wereyeti peasants' names.
sergeant = hero.findNearest(hero.findFriends())
wereList = sergeant.wereList
# The list isn't clean and contains redundant spaces. 
wereNames = wereList.split(",")

# Iterate through wereNames array:
for name in wereNames:
    # Trim the whitespace from the name
    # and save it in the new variable:
    trimed = name.trim()
    # Use findFriendByName function to find a wereyeti:
    wereyeti = findFriendByName(trimed)
    # Command that unit move to the ogre camp:
    hero.command(wereyeti, 'move', {'x':48, 'y':48})

Your code works… I don’t think you should post it here, people might copy it.

Try submitting some more, you might have got a bad seed :confused:

Is the first line supposed to be there?

Hallo Mercurum,

thank you for helping. I have tried it for several weeks. It was not accepted.

" ```

  • List item
It was somehow copied there. Of course, it should not be there.

I could hide the code, but I don’t see how to edit my post.

Hi @Lesyab. You can edit p/delete a post by pressing the pencil icon (to edit) or the trash can icon (to delete). You can find these on your post.

Hi @A.Lee456, it should be a pencil icon. But I don’t see any

Then just press the delete button

Oh, I just remembered. @Lesyab, the pencil icon will be at the top when your the person who created the topic. Sorry forgot about that…

Hallo A.Lee456, I do created this topic. It seems that after some time I can not change my topic, despite creating it.

Just delete it then :slight_smile:

I would delete it as soon as it succeeds. But this level is still not accepted. On several other levels I got similar problems, they are not accepted as they should.

ah ok…sorry I can’t help I haven’t done this level yet…maybe @mercurym can help? But they already said it should work…