# Airdrop again (Python)

**URL:** <https://discourse.codecombat.com/t/airdrop-again-python/12901>\
**Category:** Uncategorized\
**Created:** [November 8, 2017, 4:17pm UTC](https://discourse.codecombat.com/t/airdrop-again-python/12901 "2017-11-08T16:17:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuska](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kuska/32/7038_2.png) [@kuska](https://discourse.codecombat.com/u/kuska)\
**Post date:** [November 8, 2017, 4:17pm UTC](https://discourse.codecombat.com/t/airdrop-again-python/12901/1 "2017-11-08T16:17:02Z")

</div>

Hi,

I’ve got a problem with that one, too. I don’t understand the concept behind it. It says I should protect the left side. Fine. There’s the red cross where I stand and fight. My raven doesn’t search for anything, cause according to the code I should search for it but if I start the giant ogre will kill the villagers. And if I don’t I keep standing on the right cross and finally a horde of munchkins come from the other sides of the forest and kill my villagers. This is nuts.

This is my code:

```python
# Get all swords and protect the village.

def onSpawn (event):
    while True:
        item = hero.findNearestItem()
        # The pet should fetch the item if it exists:
    if item:
        pet.fetch(item)
    pass

# Assign onSpawn function for the pet's "spawn".
pet.on("spawn", onSpawn)

while True:
    # Guard the left passage: 
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
        pass

```

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [November 8, 2017, 5:05pm UTC](https://discourse.codecombat.com/t/airdrop-again-python/12901/2 "2017-11-08T17:05:46Z")

</div>

```python
if item:
        pet.fetch(item)

```

will never execute …  
Wrong indentation in while True loop.

---

<div class="post-metadata">

**Author:** ![Ironhead](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ironhead/32/7384_2.png) [@Ironhead](https://discourse.codecombat.com/u/Ironhead)\
**Post date:** [November 8, 2017, 7:06pm UTC](https://discourse.codecombat.com/t/airdrop-again-python/12901/3 "2017-11-08T19:06:53Z")

</div>

Just get better armor if your pet cannot lift them, use Okar Stompfoot.

---

<div class="post-metadata">

**Author:** ![kuska](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kuska/32/7038_2.png) [@kuska](https://discourse.codecombat.com/u/kuska)\
**Post date:** [November 8, 2017, 7:50pm UTC](https://discourse.codecombat.com/t/airdrop-again-python/12901/4 "2017-11-08T19:50:57Z")

</div>

Ha, tiny little thing. I missed it, you’re right ^^

Now works just great. Thanks ;D
