From the course: Python Data Structures: Dictionaries
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution - Python Tutorial
From the course: Python Data Structures: Dictionaries
Solution
(upbeat music) - [Narrator] Welcome back to your case study challenge. This is our last challenge for the video course, and I hope you found it useful. The solution to this challenge is using dictionary comprehension. I hope you were able to appreciate the usefulness of dictionary comprehension and got some practice using the syntax, becoming more comfortable with it. Your challenge was to create a new dictionary called treeOrders10 with subdivisions that have more than 10 tree orders. You had to use dictionary comprehension. Dictionary comprehensions and comprehensions in general have the optional conditional statement that allow for adding filter statements to solve problems such as these, let's take a look at the program. This program contains code that reads from a file and copies it to a dictionary. The dictionary holds a list of subdivision IDs and the total number of trees collected by each subdivision. And now…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.