[SOLVED]Two Flowers

# Define the function: pickUpNearestCoin
friends = hero.findByType("peasant", hero.findFriends())
for friends in friends:
    enemy = friend.findNearestEnemy()
if enemy:
    hero.command(friend, "attack", enemy)
peasant = hero.findByType("peasant")[0]

This part of yours is not what the blue text says. You should replace it with this and define the function PickUpNearestCoin

# Define the function: pickUpNearestCoin
def pickUpNearestCoin():
    items = hero.findItems()
    nearestCoin = hero.findNearest(items)
    if nearestCoin:
        hero.move(nearestCoin.pos)
2 Likes

Oh it works now! Thank you so much!

3 Likes

Your Welcome! Congrats on passing the level!

3 Likes

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