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) - [Instructor] Welcome back, to the case study, problem solution. Our problem statement was, how much can this dictionary data be manipulated? Our challenge was, let's see how, to get the size of the dictionary? As I tried to find out how big the data really is, give an option for the troop to change the number of trees collected, give an option for the troop to add a new customer, print the contents of the dictionary. Our solution for size of the dictionary is really simple. If you recollect, we do len, mydict as the parameter, where my dict is the name of a dictionary. For the rest, let's look at sublime editor for the code. Here we have size of Di, equals len mydict, and we print size of Di. If we were to compile it and run it Ctrl B, we see it shows, 159. Now, if you look at line 22, mydict 205 equals 10. And we print the dictionary, 205 here, shows the change that has taken place. Line 25…
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.