June 2025
Beginner to intermediate
473 pages
13h 30m
English
Lists represent the dominant data structure in many Python scripts. Nevertheless, you should also know three other basic Python data structures, namely, tuples (sequences), sets, and dictionaries.
A tuple is a special form of an immutable list. In a sense, tuples are the more primitive data structure. Their internal administration is associated with low overhead. Tuples are formulated in parentheses. If no syntactic ambiguities can occur, it is permissible to omit the parentheses.
>>> t = (12, 73, 3)>>> t (12, 73, 3)>>> t = 12, 73, 3>>> t (12, 73, 3)
A useful way to apply tuples are functions that do not return one result, but a pair of values or a combination of several data. Thus, the following example ...
Read now
Unlock full access