Advanced Python data structures by Reuven M. Lerner

Advanced Python data structures

Stretch built-in data structures to their limits, and explore collections in Python's standard library.

Comfortable with strings, lists, tuples, and dicts?

If you've been programming in Python for any length of time, then you're almost certainly familiar with the basic, built-in data structures: Strings, lists, tuples, and dicts.  You probably use them every day, both by themselves, in combinations, and in classes that you write.

This course takes you beyond the basics, to really get the most out of Python's data structures.

First, we review the basic, built-in structures — not for their basic functionality, but rather to understand how they work behind the scenes, and how some of the more unusual and advanced methods can save you time and make your code clearer.

Next, we look at how we can combine Python's built-in collections in five ways: lists of lists, lists of tuples, lists of dicts, dicts of dicts, and dicts of lists.  We compare the efficiency and coding that's necessary, considering how and when we would need each one.

Finally, we look at some of the useful data structures provided to us in Python's standard library — including such useful tools as Counter and Enums.

If you want to make your Python code sing, then you need to truly master Python's data structures. This course will help you to do so — with seven hours of video, and numerous exercises.

What's included?

Video Icon 58 videos File Icon 13 files

Contents

00 Welcome
2 mins
Section 1: Digging deeper into basic data structures
Section 1.ipynb
119 KB
01 Object ids
8 mins
02 is vs ==
5 mins
03 When to use is
6 mins
04 sys.getsizeof
6 mins
05 Boolean context
5 mins
06 How big is an int?
3 mins
07 Binary, hex, and octal numbers
8 mins
08 Timing number conversions
3 mins
09 Size and limit of floats
5 mins
10 String interning
9 mins
11 str.splitlines
4 mins
12 Combining and interpolating strings
11 mins
13 List memory usage
6 mins
14 Creating lists efficiently
3 mins
15 Splitting and unpacking
6 mins
16 Tuples
7 mins
16a Sequences
5 mins
17 Exercises 1
2 mins
exercises-1.txt
736 Bytes
18 Exercise solutions 1
11 mins
19 Creating dicts
7 mins
20 Setting and retrieving key-value pairs
7 mins
21 Iterating over dicts
6 mins
22 Merging dicts
4 mins
23 dict.fromkeys
5 mins
24 Removing items from a dict
3 mins
25 Sets and frozensets
7 mins
26 Exercises 2
3 mins
exercises-2.txt
817 Bytes
27 Exercise 2 solutions
6 mins
Section 2: Combinations of basic data structures
Section 2.ipynb
26.2 KB
28 Complex data structures
3 mins
29 Lists of lists
8 mins
30 Movie store with a list of lists
9 mins
31 Movie store with a list of tuples
4 mins
32 Exercises 3
4 mins
exercises-3.txt
1.01 KB
33 Exercise 3 solutions
17 mins
34 Lists of dicts
11 mins
35 Exercise 4
1 min
exercises-4.txt
1 KB
36 Exercise 4 solutions
10 mins
37 Dict of dicts
10 mins
38 Exercise 5
2 mins
exercises-5.txt
1.1 KB
39 Exercise 5 solution
14 mins
40 Dict of lists
6 mins
41 Exercise 6
1 min
exercises-6.txt
252 Bytes
words.zip
737 KB
42 Exercise 6 solution
5 mins
43 Advanced data structures in the standard library
3 mins
Section 3: Useful items from the standard library
Section 3 — Complex data types from the standard library.ipynb
46.3 KB
44 Decimal
6 mins
45 Named tuples
7 mins
46 Exercise 7
2 mins
exercises-7.txt
428 Bytes
47 Exercise 7 solution
5 mins
48 defaultdict
7 mins
49 OrderedDict
3 mins
50 Counter
6 mins
51 Exercise 8
2 mins
exercises-8.txt
740 Bytes
52 Exercise 8 solutions
7 mins
53 Enums
8 mins
54 Exercise 9
2 mins
exercises-9.txt
571 Bytes
55 Exercise 9 solution
5 mins
56 Conclusion
1 min

FAQs

What version of Python do you use?

This course uses Python 3.7, the most recent as of when I recorded it.

Can I buy this course for my team at work?

Yes, I have sold these video courses to many companies. Contact me  (at reuven@lerner.co.il) for details.

I'm a student or pensioner. Can I get a discount?

I know very well what it's like to be a student on a limited budget; I spent 11 years (!) on my PhD.  So yes, as with all of my products, there's a student discount.  E-mail me (reuven@lerner.co.il), and I'll send you the appropriate coupon code.

And while I don't yet know what it's like to be a pensioner/retiree, I do understand that it can be similarly challenging. For that reason, I have the same offer: E-mail me, and I'll give you the same discount as I give to students.

This price is far too high for someone living in my country. Do you offer "parity pricing," or something like it, for people outside of the world's wealthiest countries?

Absolutely! I give an automatic discount to any permanent resident of a country outside of the world's 30 richest countries.  Just e-mail me (reuven@lerner.co.il), and I'll send you the appropriate coupon code.

The coronavirus pandemic has affected my finances. Can I get a discount?

Yes, I give an automatic discount to anyone who has suffered financial hardship as a result of the novel coronavirus pandemic of 2020.  Just e-mail me (reuven@lerner.co.il), and I'll send you the appropriate coupon code.

What if I dislike the course?

If you didn't get any value from the course, then just e-mail me (reuven@lerner.co.il) and ask for a refund.

What if I have more questions?

Just e-mail me at reuven@lerner.co.il, and I'll try to answer as quickly as possible.