
116 Introduction to Computational Models with Python
It is possible to build lists of tuples and tuples of lists. The following
command defines a list myltt of tuples.
>>> myltt = [(12, 45.25), (45, 68.5), (25, 78.95)]
>>> myltt
[(12, 45.25), (45, 68.5), (25, 78.95)]
The following command defines a tuple mytup of lists.
>>> mytup = ([14, 45.25], [55, 68.5], [28, 78.95])
>>> mytup
([14, 45.25], [55, 68.5], [28, 78.95])
7.7 DICTIONARIES
Dictionaries are also Python data structur e s except that these are index ed
by keys. A dictionary is used as an unordered set of key and value pairs that
are enclosed in curly brac es. The key can be any immutable type