Exercises
In addition to enhancing the examples in this chapter, there are many other exercises:
- Create a
SortedDictcollection that takes akeyfuncto decide the sort order. - Create a
SortedListcollection that hasO(log(n))inserts and always returns a sorted list during each iteration. - Create a Borg pattern that has a state per subclass.
Example answers for these exercises can be found on GitHub: https://github.com/mastering-python/exercises. You are encouraged to submit your own solutions and learn about alternative solutions from others.