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

Create a function named word_count() that takes a string. Return a dictionary with each word in the string as the key an

new_str = "I love what I said".split() new_dict = {} def word_count(new_str): for i in new_str: if new_str.count(i)>=2: new_dict[i] = new_str.count(i) else: new_dict[i] = 1 word_count(new_str) print(new_dict)

this is what I made the program, it work well in python3.4, but could pass the website, which said failed. I think is this website is bug. Am I right?

2 Answers

This challenge works.
Make sure to pass the .lower() method on the split string and return the dictionary rather than printing it.
Also, you can paste in code in a more readable format if you enclose it with three backticks (`)
Check the Markdown Cheatsheet below for more info.

thank you for telling me, is that very important to using the function .lower(), or just the website they said you need to this.