# \[SOLVED\] Help: the hunt begins

**URL:** https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326
**Category:** Level Help
**Created:** [October 2, 2019, 8:58pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326 "2019-10-02T20:58:12Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 2, 2019, 8:58pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/1 "2019-10-02T20:58:12Z")

</div>

help i cant do this

[en\_US.composer.my\_button\_text]

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 2, 2019, 10:08pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/2 "2019-10-02T22:08:42Z")

</div>

# But he doesn’t know how big a Burleous Majoris would be…

# Find the average size of this burl population to use as a baseline!

# This function returns average size of all the burls in an array.

def averageSize(burls):  
sum = sumSize(burls)  
# Remember the average is the sum of the parts divided by the amount!  
return sum / burls.length

# This function should return the sum of all the burls sizes.

def sumSize(burls):  
# Implement the sum function using the burls ‘size’:  
burlHealth = 0  
enemies = hero.findEnemies()  
for burls in enemies:  
burlHealth += burl.health

while True:  
# Find the average size of the burls by calling the ‘averageSize’ function

```
averageSize()
# Say the average size of the seen burls!
hero.say(averageSize)
```

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [October 3, 2019, 3:00pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/3 "2019-10-03T15:00:23Z")

</div>

Welcome to the Codecombat discourse.

> [@pa\_ki](#):
>
> ```python
> # Implement the sum function using the burls ‘size’:
> 
> ```

This is the important line here. ‘size’ would translate to object.size, not object.health.  
And when you use the averageSize() function in the while true loop, you need to set it to a variable then say the variable. e.g. myName = getMyName(hero.findNames()) hero.say(myName)  
I hope this helps.

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 3, 2019, 9:04pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/4 "2019-10-03T21:04:34Z")

</div>

it has an error  
it says: TypeError: Cannot read ‘property’ length of undefined

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [October 4, 2019, 8:46am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/5 "2019-10-04T08:46:03Z")

</div>

Make sure you put the ‘burls’ array in the brackets of the averageSize() function, otherwise you checking the averageSize of nothing.

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 4, 2019, 7:43pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/6 "2019-10-04T19:43:12Z")

</div>

this is my code:

# This function returns average size of all the burls in an array.

def averageSize(burls):  
sum = sumHealth(burls)  
# Remember the average is the sum of the parts divided by the amount!  
enemies = hero.findEnemies()  
for burl in enemies:  
return sum / burls.length

# This function should return the sum of all the burls sizes.

def sumHealth(burls):  
# Implement the sum function using the burls ‘size’:  
burlHealth = 0  
enemies = hero.findEnemies()  
for burl in enemies:  
burlHealth += burl.health  
return burlHealth

while True:  
# Find the average size of the burls by calling the ‘averageSize’ function

```
averageSize()
# Say the average size of the seen burls!
hero.say(averageSize)

```

how do i format my code

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [October 5, 2019, 6:07pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/7 "2019-10-05T18:07:46Z")

</div>

Look at this topic: [link](https://discourse.codecombat.com/t/how-to-post-your-code-with-radiant-harmonious-formatting/1484), for formatting.

> [@pa\_ki](#):
>
> ```python
> averageSize() 
> # Say the average size of the seen burls! 
> hero.say(averageSize)
> 
> ```

you still haven’t changed this section. Reread my posts above and see if you can figure it out.

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 6, 2019, 12:10am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/8 "2019-10-06T00:10:08Z")

</div>

my new code

```python
def averageSize(burls):
    sum = sumHealth(burls)
    # Remember the average is the sum of the parts divided by the amount!
    burls = hero.findByType("burl")
    for burl in burls:
        return sum / burls.length

def sumHealth(burls):
    # Implement the sum function using the burls 'size':
    burlHealth = 0
    enemies = hero.findEnemies()
    for burl in enemies:
        burlHealth += burl.health
        return burlHealth
        

while True:
    
    
    averageSize()
    # Say the average size of the seen burls!
    hero.say(averageSize)]

```

can you please show me a link for your posts

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 6, 2019, 12:11am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/9 "2019-10-06T00:11:02Z")

</div>

my hero says: [Function averageSize]

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [October 6, 2019, 4:42pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/10 "2019-10-06T16:42:50Z")

</div>

My posts are the ones above in this topic, ah well, I’ll tell you again.  
Your problem’s still here:

> [@pa\_ki](#):
>
> ```python
> averageSize() 
> # Say the average size of the seen burls! 
> hero.say(averageSize)
> 
> ```

look at this function:  
`averageSize()` It needs to have something in the brackets () to use here:

> [@pa\_ki](#):
>
> `sum = sumHealth(burls)`

You can use an array. e.g. hero.findEnemies(), you would put that value into a variable (enemies = hero.findEnemies()) then put that value into a function: damage = totalDamage(enemies).  
Do you understand now?

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 16, 2019, 8:43pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/11 "2019-10-16T20:43:53Z")

</div>

```python

# But he doesn't know how big a Burleous Majoris would be...
# Find the average size of this burl population to use as a baseline.

# This function returns average size of all the burls in an array.
def averageSize(burls):
    sum = sumHealth(burls)
    # Remember the average is the sum of the parts divided by the amount!
    burls = hero.findByType("burl")
    for burl in burls:
        return sum / burls.length

# This function should return the sum of all the burls sizes.
def sumHealth(burls):
    # Implement the sum function using the burls 'size':
    burlHealth = 0
    enemies = hero.findEnemies()
    for burl in enemies:
        burlHealth += burl.health
        return burlHealth
        

while True:
    # Find the average size of the burls by calling the 'averageSize' function
    enemies = hero.findEnemies()
    burls = hero.findByType("burls")
    burls = averageSize(burls)
    averageSize(burls)
    
    # Say the average size of the seen burls!
    hero.say(averageSize)
```

---

<div class="post-metadata">

### Author: ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)
#### Post date: [October 16, 2019, 9:39pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/12 "2019-10-16T21:39:04Z")

</div>

never mind i solved it

---

<div class="post-metadata">

### Author: ![MrJumping](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/mrjumping/32/12547_2.png) [@MrJumping](https://discourse.codecombat.com/u/MrJumping)
#### Post date: [June 2, 2020, 4:58pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/13 "2020-06-02T16:58:13Z")

</div>

Hello. Can anyone please help me? I’m stuck on this level as well.

```python
// Senick is trying to find the elusive Burleous Majoris!
// "But he doesn't know how big a Burleous Majoris would be..."
// Find the average size of this burl population to use as a baseline!

// This function returns average size of all the burls in an array.
function averageSize(burls) {
    var sum = sumSize(burls);
    // Remember the average is the sum of the parts divided by the amount!
    return sum / burls.length;
}

// This function should return the sum of all the burls sizes.
function sumSize(burls) {
    // Implement the sum function using the burls 'size':
    var sum = 0;
    for (var i = 0; i < burls.length; i++) {
        var burl = burls[i];
        var health = burl.health;
        sum = sum + health;
    }
    return sum;
}

while(true) {
    // Find the average size of the burls by calling the 'averageSize' function.
    var burls = hero.findEnemies();
    hero.say(averageSize(burls));
    // Say the average size of the seen burls!
}

```

---

<div class="post-metadata">

### Author: ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)
#### Post date: [June 4, 2020, 11:09pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/14 "2020-06-04T23:09:06Z")

</div>

In your averageSize function, you are calling your other function, but are not defining the object this other function needs to work with.

Also, in your second function, take a closer look at this comment:

```javascript
    // Implement the sum function using the burls 'size':

```

You need to adjust your code accordingly.

---

<div class="post-metadata">

### Author: ![TEO](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/teo/32/23025_2.png) [@TEO](https://discourse.codecombat.com/u/TEO)
#### Post date: [August 31, 2020, 4:54am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/15 "2020-08-31T04:54:07Z")

</div>

this is my code can you help me?

```python
# But he doesn't know how big a Burleous Majoris would be...
# Find the average size of this burl population to use as a baseline.

# This function returns average size of all the burls in an array.
def averageSize(burls):
    sum = sumHealth(burls)
    # Remember the average is the sum of the parts divided by the amount!
    burls = hero.findByType("burl")
    for burl in burls:
        return sum / burls.length

# This function should return the sum of all the burls sizes.
def sumHealth(burls):
    # Implement the sum function using the burls 'size':
    burlHealth = 0
    enemies = hero.findEnemies()
    for burl in enemies:
        burlHealth += burl.health
        return burlHealth
        

while True:
    # Find the average size of the burls by calling the 'averageSize' function
    enemies = hero.findEnemies()
    burls = hero.findByType("burls")
    burls = averageSize(burls)
    averageSize(burls)
    
    # Say the average size of the seen burls!
    hero.say(averageSize)

```

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [August 31, 2020, 5:11am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/16 "2020-08-31T05:11:33Z")

</div>

> [@TEO](#):
>
> `return burlHealth`

You should return this after the for loop is over.

Andrei

---

<div class="post-metadata">

### Author: ![TEO](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/teo/32/23025_2.png) [@TEO](https://discourse.codecombat.com/u/TEO)
#### Post date: [August 31, 2020, 5:34am UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/17 "2020-08-31T05:34:19Z")

</div>

thank you very much @AnSeDra i got it

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)
#### Post date: [August 31, 2020, 5:34pm UTC](https://discourse.codecombat.com/t/solved-help-the-hunt-begins/19326/18 "2020-08-31T17:34:27Z")

</div>

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