Convienient enemy help python

i just dont understand what it means by separate and i dont know how to separate the last word from the sentence. code:

# The last word in the peasants' messages are a hint.

for x in range(8, 73, 16):
    hero.moveXY(x, 22)
    # Peasants know whom to summon.
    peasant = hero.findNearest(hero.findFriends())
    message = peasant.message
    if message:
        # Words are seaparated by whitespaces.
        words = message.split(" ")
        # "words" is an array of words from the "message".
        # Get the last word. It's the required unit type.
        # Summon the required unit type.
        
for i in range(len(hero.built)):
    unit = hero.built[i]
    # Command the unit to defend the unit's position.
    hero.command(unit, "defend", unit.pos)

# Defend the last point yourself:
while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == "ogre-f":
        hero.attack(enemy)
        enemy = hero.findNearestEnemy()
    else:
        hero.findNearestEnemy()```

Could you send me the link?
Lydia

https://codecombat.com/play/level/convenient-enemy?

1 Like

what is ogre-f I don’t think that is a ogre type

I can’t help you on this level that much because I haven’t completed it yet.

Read this carefully.

All you need for this part is a simple attack code.

is not a type of ogre.
Lydia

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.