#100DaysOfCode in Python Transcripts
Chapter: Days 4-6: Collections module
Lecture: Deque: when lists become slow

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,
0:02 namedtuples, an elegant and readable way to create tuples,
0:07 and instead of user index zero, and index one,
0:10 you can say user.name and user.role.
0:13 A defaultdict is great way
0:15 to buildup a nested data structure,
0:18 you don't get key errors, because the internals
0:20 make sure that the value gets initialized
0:23 before appending to it.
0:25 Counter, don't reinvent the wheel,
0:28 so here at the top you see all the code
0:30 I needed to get the top five words in a string,
0:34 and below we did the same,
0:35 but only with one line of code, very powerful.
0:38 A deque, so lists are your best friend,
0:41 but if you have to insert at them at the start,
0:45 for example, they get very slow.
0:48 So deques are great if you need to insert
0:50 and remove at both ends of the sequence.
0:52 And now it's your turn.