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 (2016, retired 2019) Dictionaries Word Count

eestsaid
eestsaid
1,311 Points

Word count challenge - where to start

Not really sure where to start with this one. Steps Im thinking about are:

  • Change the string to a list using split
  • Run a for loop to get the count of each word and put the word and the count in a new list
  • Change the list to a dictionary

Problem with the above it doesn't really draw on recent content so seems arbitrary and the most common method I've been able to find t change a list to dictionary is using the dict() method.

Do the above steps sound like I might be on the right path???

Thanks team

2 Answers

you are close!

You also need to use nested for loop and a counter

eestsaid
eestsaid
1,311 Points

Thanks bot.net - I've taken a breather from this challenge and will come back to it. I will let you know how I go.