Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


word_count: Dictionaries: coding_challenge

Hi, You can see my codee here: I hope it's ok: http://pastie.org/private/xkfkyrdxxefin0e108viiq I think I'm near to the soloution and have understood the principles but something is still wrong. Sometimes it is difficult for me to transport my ideas into the right syntax:

Thanks for your help, Alexandra

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 67,989 Points

Hi Alexandra, There are two errors in your code:

def word_count(string):  # <-- typo: parameter did not match "string" used in the code
    for word in list_1:
        if word in dict_1:
            dict_1.update({word:1})  # <-- corrected syntax for dictionary object
    return dict_1  # <-- add missing return statement

Edit: The third error is you're missing a return statement. Added above.

Thank you very much:) But I was on the right way. Thanks!