like dictionariespython lists use an extremely efficient and well-tuned internal data structure so we can worry about what we're storingrather than how we're storing it many object-oriented languages provide different data structures for queuesstackslinked listsand array-based lists python does provide special instances of some of these classesif optimizing access to huge sets of data is required normallyhoweverthe list data structure can serve all these purposes at onceand the coder has complete control over how they access it don' use lists for collecting different attributes of individual items we do not wantfor examplea list of the properties particular shape has tuplesnamed tuplesdictionariesand objects would all be more suitable for this purpose in some languagesthey might create list in which each alternate item is different typefor examplethey might write [' ' ' ' for our letter frequency list they' have to use strange loop that accesses two elements in the list at once or modulus operator to determine which position was being accessed don' do this in python we can group related items together using dictionaryas we did in the previous section (if sort order doesn' matter)or using list of tuples here' rather convoluted example that demonstrates how we could do the frequency example using list it is much more complicated than the dictionary examplesand illustrates the effect choosing the right (or wrongdata structure can have on the readability of our codeimport string characters list(string ascii_letters["def letter_frequency(sentence)frequencies [( for in charactersfor letter in sentenceindex characters index(letterfrequencies[index(letter,frequencies[index][ ]+ return frequencies this code starts with list of possible characters the string ascii_letters attribute provides string of all the letterslowercase and uppercasein order we convert this to listand then use list concatenation (the plus operator causes two lists to be merged into oneto add one more characterthe space these are the available characters in our frequency list (the code would break if we tried to add letter that wasn' in the listbut an exception handler could solve this