# Help with usual day... lots of help pz

**URL:** <https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614>\
**Category:** Level Help\
**Created:** [September 23, 2021, 11:44pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614 "2021-09-23T23:44:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antoni\_Druzynski](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/antoni_druzynski/32/24741_2.png) [@Antoni\_Druzynski](https://discourse.codecombat.com/u/Antoni_Druzynski)\
**Post date:** [September 23, 2021, 11:44pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/1 "2021-09-23T23:44:18Z")

</div>

i need help. what is wrong with my code?

```python
while True:
    enemy = hero.findNearestEnemy()
    # With AND, the type is only checked if enemy exists.
    if enemy.type == "munchkin":
        hero.attack(enemy)
    # Find the nearest item.
    item = hero.findNearestItem()
    # Collect item if it exists and its type is "coin".
    if item.type == "coin":
        hero.moveXY(item.pos.x, item.pos.y)

```

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [September 23, 2021, 11:52pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/2 "2021-09-23T23:52:08Z")

</div>

Please don’t post on different topics.

---

<div class="post-metadata">

**Author:** ![Antoni\_Druzynski](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/antoni_druzynski/32/24741_2.png) [@Antoni\_Druzynski](https://discourse.codecombat.com/u/Antoni_Druzynski)\
**Post date:** [September 23, 2021, 11:53pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/3 "2021-09-23T23:53:19Z")

</div>

excuse me i dont understand

---

<div class="post-metadata">

**Author:** ![Antoni\_Druzynski](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/antoni_druzynski/32/24741_2.png) [@Antoni\_Druzynski](https://discourse.codecombat.com/u/Antoni_Druzynski)\
**Post date:** [September 23, 2021, 11:54pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/4 "2021-09-23T23:54:44Z")

</div>

oh sorry now i understand but in the other topic it was about enemy.types so i thought that someone could help me there

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [September 24, 2021, 12:52am UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/5 "2021-09-24T00:52:36Z")

</div>

If it is on the same level there is no need to make another topic for the same level. @Chaboi_3000 @Deadpool198 Can you please close this?

---

<div class="post-metadata">

**Author:** ![Antoni\_Druzynski](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/antoni_druzynski/32/24741_2.png) [@Antoni\_Druzynski](https://discourse.codecombat.com/u/Antoni_Druzynski)\
**Post date:** [September 24, 2021, 3:03am UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/6 "2021-09-24T03:03:39Z")

</div>

sorry i didn’t know 😒 i did find the answer though. thanks eric tang

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [September 24, 2021, 3:07am UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/7 "2021-09-24T03:07:17Z")

</div>

Your good man. No need to feel sad. I did that to I think tbh.

---

<div class="post-metadata">

**Author:** ![Alfa\_Jayden\_Iskandar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/alfa_jayden_iskandar/32/23714_2.png) [@Alfa\_Jayden\_Iskandar](https://discourse.codecombat.com/u/Alfa_Jayden_Iskandar)\
**Post date:** [September 24, 2021, 4:55am UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/8 "2021-09-24T04:55:36Z")

</div>

the if enemy.type == ‘munchkin’ suppose to be if enemy and enemy.type == ‘munchkin’:  
because the comment line says with and. same with the item

---

<div class="post-metadata">

**Author:** ![Coder3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/coder3/32/22935_2.png) [@Coder3](https://discourse.codecombat.com/u/Coder3)\
**Post date:** [September 25, 2021, 9:32pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/9 "2021-09-25T21:32:58Z")

</div>

And also add if enemy

And if item

Or else if there’s no enemy or item, it will be an error.

---

<div class="post-metadata">

**Author:** ![Antoni\_Druzynski](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/antoni_druzynski/32/24741_2.png) [@Antoni\_Druzynski](https://discourse.codecombat.com/u/Antoni_Druzynski)\
**Post date:** [September 26, 2021, 10:06pm UTC](https://discourse.codecombat.com/t/help-with-usual-day-lots-of-help-pz/30614/10 "2021-09-26T22:06:51Z")

</div>

thanks a lot i will see if working now
