#100DaysOfCode in Python Transcripts
Chapter: Days 4-6: Collections module
Lecture: Concepts: what did we learn
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
So a quick overview of we've learned so far, namedtuples, an elegant and readable way to create tuples, and instead of user index zero, and index one,
0:11
you can say user.name and user.role. A defaultdict is great way to buildup a nested data structure, you don't get key errors, because the internals
0:21
make sure that the value gets initialized before appending to it. Counter, don't reinvent the wheel, so here at the top you see all the code
0:31
I needed to get the top five words in a string, and below we did the same, but only with one line of code, very powerful.
0:39
A deque, so lists are your best friend, but if you have to insert at them at the start, for example, they get very slow.
0:49
So deques are great if you need to insert and remove at both ends of the sequence. And now it's your turn.