The Hunt Begins- python

def averageSize(burls):
sum = sumSize(burls)
return sum / len(burls)

def sumSize(burls):

sum = 0
for i in range(len(burls)):
    burl = burls[i]
    sum += burl.size
return sum

burls = hero.findEnemies()
avgSize = averageSize(burls)

can someone tell me why this doesn’t work.

Maybe errors in averageSize

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

burls.length not len(burls)

Ok thanks Rob, I’ll make the change and see if it works:):ok_hand:

still saying the answer i get is wrong

I don’t see anything wrong with your code. Try submitting the code instead of running it.

keep running the code over and over
same thing for me too
i took like 20 submits to get it

(definitely 20 chars)

ok thanks all. shall try and let you know

submitted it 7 times and it worked. thank you so much

I had the same problem. I couldn’t seem to get it to work no matter how many times I hit submit. I knew my code was right. It was the same code as I’ve seen posted in other topics about this level. I decided to try buying glasses with a longer range and as soon as I did that I succeeded immediately.

So my guess is that whichever glasses I had on didn’t have enough range to see all the burls that the correct answer expects. If anyone else is stuck on this level I’d recommend trying better glasses. Hopefully it will save you some frustration. I know I feel relieved to be past this level now.

Hi, I need some help with this level. Here is my code:

Hi battleAngel923,

Welcome to the forum! We’d be happy to help you solve your problem.

Please could you post all your code for the level, as the screenshot only shows some of it. There’s instructions for how to post the code so it formats properly here.