Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (Retired) Dictionaries Word Count

Sometime's the compiler can't find my function even though it's named correctly. What gives?

I keep getting the error "Where's word_count()?" Here's my code.

def word_count(str_some):

  str_some = str_some.lower()
  arr_some = str_some.split()


  for idx in arr_some:
    if idx in dict_let:
      dict_let[idx] += 1

    else:
      dict_let[idx] = 1

  return dict_let

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Where's dict_let?

If there's a problem in the function, often the compiler can't find it because it wasn't successfully added to the registry.

Thanks for the speedy answer! I initialized dict_let and it worked. It can be kind of frustrating when the error doesn't give you any useful information, and it's especially difficult to troubleshoot errors in the code challenges. At least I know I can come back to the forum!