Dictionaries and Tuples

Another application of tuples is to use them as keys in dictionaries. Follow and practice the examples presented in this section in order to understand how tuples can be used with dictionaries.


This chapter presents one more built-in type, the tuple, and then shows how lists, dictionaries, and tuples work together. I also present a useful feature for variable-length argument lists, the gather and scatter operators. One note: there is no consensus on how to pronounce "tuple". Some people say "tuh-ple", which rhymes with "supple". But in the context of programming, most people say "too-ple", which rhymes with "quadruple".

Source: Allen B. Downey, http://greenteapress.com/thinkpython2/html/thinkpython2013.html
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 License.