A set is a collection of items where each item is unique. This is derived from the mathematical concept of the same name. Python has two built-in types for sets:
set is a mutable object while
frozenset provides an immutable implementation.
collections library includes the
Counter object which is an implementation of a multiset, it stores both the unique items and a count as to how many times it has been added to the container.
Here are resources and additonal documentation about sets:
- Built-in Types:Set types – set, frozenset | Python Documentation
- collections – Container Datatypes:Counter objects | Python Documentation
- Sets in Python - Real Python Article
- Sets in Python - Real Python Course
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.