- [Instructor] Just about every non-trivial Python program…uses dictionaries in some way.…They are a great way to associate data values…with unique keys for fast lookup.…The collections module provides two…interesting dictionary subclasses to help out…with common scenarios where a regular dictionary…would need unnecessary code.…So, one such example is the default dict,…which we'll examine in this example.…It's a fairly common scenario…to use dictionaries to keep track of data,…such as the result of counting operations.…
So, here in VS Code, I'm going to open up…the defaultdict_start example…in my collections folder,…and, you can see that I have a list here…of different kinds of fruit, and I want to count the number…of each kind of fruit that I have.…So, I have some code that iterates over the list,…and uses a dictionary to keep track…of the count of each type of fruit.…Now, the code that I have right now…is going to produce an error,…when I try to run it, so let's see.…
I'll try to run this, and there you can see,…
- Truth value testing
- Template strings
- Advanced Python functions
- Advanced collections
- Advanced classes and objects
- Python comprehensions: list, dictionary, and set
Skill Level Advanced
1. Python Language Features
2. Built-In Functions
3. Advanced Python Functions
4. Advanced Collections
5. Advanced Classes and Objects
6. Using Logging
7. Python Comprehensions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.