September 2026
1051 pages
35h 4m
English
In this chapter, we’ll take a look at two more categories of data types: mappings and sets. The mappings category contains data types that establish a mapping between different objects. The only basic data type that falls into this category is the dictionary.
A set is a unordered collection of elements in which each element may be contained only once. In Python, there are two basic data types for representing sets: set for a mutable set and frozenset for an immutable set. Thus, set is mutable and frozenset is immutable.
|
Data type |
Stores |
Mutability |
Section |
|---|---|---|---|
|
dict |
Key-value mappings |
Mutable |
|
|
set |
Sets of any instances |
Mutable |
|
|
frozenset |
Sets of any instances |
Immutable ... |
Read now
Unlock full access