# \[SOLVED\] Please help with Usual day (backwoods forest). I would really appreciate it. I don't know what to do after the line "if item and item.type == "coin":

**URL:** https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825
**Category:** Level Help
**Created:** [October 18, 2020, 2:27am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825 "2020-10-18T02:27:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:27am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/1 "2020-10-18T02:27:10Z")

</div>

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

```

---

<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: [October 18, 2020, 2:30am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/2 "2020-10-18T02:30:03Z")

</div>

Can you give the link please?

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:30am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/3 "2020-10-18T02:30:56Z")

</div>

What do you mean?  
_ignore this_  
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review [this topic](https://discourse.codecombat.com/t/welcome-to-codecombat-discourse-forums/15601), which shows all essentials of this board! Thanks!

---

<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: [October 18, 2020, 2:31am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/4 "2020-10-18T02:31:21Z")

</div>

the link of the level

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:31am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/5 "2020-10-18T02:31:53Z")

</div>

([https://codecombat.com/play/level/usual-day?)](https://codecombat.com/play/level/usual-day?))

---

<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: [October 18, 2020, 2:35am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/6 "2020-10-18T02:35:12Z")

</div>

You defined the item but you didn’t move to it.

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:39am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/7 "2020-10-18T02:39:32Z")

</div>

yeah so like it says hero.attack(enemy), what am supposed to say in terms of collecting the coin? Meaning, how do you collect it ? do you say

```python
 items = hero.findItems()

```

---

<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: [October 18, 2020, 2:41am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/8 "2020-10-18T02:41:03Z")

</div>

hero.moveXY(item.pos.x, item.pos.y)

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:43am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/9 "2020-10-18T02:43:08Z")

</div>

yeah but when i put that it says incomplete, it says that i did more then 8 statements

---

<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: [October 18, 2020, 2:43am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/10 "2020-10-18T02:43:49Z")

</div>

```python
items = hero.findItems()`would make a array`

```

---

<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: [October 18, 2020, 2:46am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/11 "2020-10-18T02:46:10Z")

</div>

Did you write `items = hero.findItems()?`  
because if you did delete it.

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:49am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/12 "2020-10-18T02:49:45Z")

</div>

when i delete that it says item is not defined

---

<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: [October 18, 2020, 2:50am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/13 "2020-10-18T02:50:51Z")

</div>

Can you show me your code right now?

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:52am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/14 "2020-10-18T02:52:10Z")

</div>

```python
while True:
    enemy = hero.findNearestEnemy()
    
    if enemy and enemy.type == "munchkin":
        hero.attack(enemy)
    item = hero.findItems()
    if item and 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: [October 18, 2020, 2:53am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/15 "2020-10-18T02:53:21Z")

</div>

```python
item = hero.findItems should be `item = hero.findNearestItem`

```

---

<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: [October 18, 2020, 2:53am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/16 "2020-10-18T02:53:57Z")

</div>

except for that your code looks right

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 2:54am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/17 "2020-10-18T02:54:50Z")

</div>

ok i tried it and here is what happened:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/c232b6fd4d3d216326eff3e5b82e6254fd652184.png)

---

<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: [October 18, 2020, 2:58am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/18 "2020-10-18T02:58:28Z")

</div>

I found your problem you didn’t add () on the end of `item = hero.findNearestItem()`  
sorry I did that

---

<div class="post-metadata">

### Author: ![Saanvi\_K](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/saanvi_k/32/12881_2.png) [@Saanvi\_K](https://discourse.codecombat.com/u/Saanvi_K)
#### Post date: [October 18, 2020, 3:03am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/19 "2020-10-18T03:03:01Z")

</div>

THank you it worked!

---

<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: [October 18, 2020, 3:03am UTC](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825/20 "2020-10-18T03:03:38Z")

</div>

Glad it did 😁  
(20 chars)

[Next page](https://discourse.codecombat.com/t/solved-please-help-with-usual-day-backwoods-forest-i-would-really-appreciate-it-i-dont-know-what-to-do-after-the-line-if-item-and-item-type-coin/24825.md?page=2)
