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


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 68,423 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!