tuples thou juliet that my thee the fact that this complex data parsing and analysis can be done with an easy-tounderstand -line python program is one reason why python is good choice as language for exploring information using tuples as keys in dictionaries because tuples are hashable and lists are notif we want to create composite key to use in dictionary we must use tuple as the key we would encounter composite key if we wanted to create telephone directory that maps from last-namefirst-name pairs to telephone numbers assuming that we have defined the variables lastfirstand numberwe could write dictionary assignment statement as followsdirectory[last,firstnumber the expression in brackets is tuple we could use tuple assignment in for loop to traverse this dictionary for lastfirst in directoryprint(firstlastdirectory[last,first]this loop traverses the keys in directorywhich are tuples it assigns the elements of each tuple to last and firstthen prints the name and corresponding telephone number sequencesstringslistsand tuples oh myi have focused on lists of tuplesbut almost all of the examples in this also work with lists of liststuples of tuplesand tuples of lists to avoid enumerating the possible combinationsit is sometimes easier to talk about sequences of sequences in many contextsthe different kinds of sequences (stringslistsand tuplescan be used interchangeably so how and why do you choose one over the othersto start with the obviousstrings are more limited than other sequences because the elements have to be characters they are also immutable if you need the ability to change the characters in string (as opposed to creating new string)you might want to use list of characters instead lists are more common than tuplesmostly because they are mutable but there are few cases where you might prefer tuples