Code Challenge 13 - Highest Rated Movie Directors - Review

PyBites, Sat 08 April 2017, Challenges

codechallenges, data analysis, defaultdict, imdb, learning, movies, namedtuples, sort

It's end of the week again so we review the code challenge of this week: Highest Rated Movie Directors. It's never late to join, just fork us and start coding.

Our solution and learning

You can find our solution here. Some highlights:


We realized during the challenge that you could also solve this with SQL or Pandas. We will update the solutions branch when we get around this. It would be nice to give it a try. Of course if you took these (or other) approaches feel free to share your solution opening a PR against our community branch.


Here is another solution by atakume we merged in our community branch. What we like about this solution is the use of itertools.groupby, doing the sorting outside the print_results function, and the second namedtuple which adds readability:

Filmography = namedtuple('Filmography', 'director movies avg_score')

Stay tuned

Next week we will let you play with decorators, a great feature for writing DRY, reusable code. It will be fun :)

We hope you are enjoying these challenges, learning along the way. Let us know if you have any issue and/or contact us if you want to submit a cool challenge. See you next week ...

PyBites Python Tips

Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.

Get our Python Tips Book

"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H

"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B

"This is now my favourite first Python go-to reference." - Anthony L

"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S

Get the book