multiple ways to map values back to keys with bit of extra generalizable codek 'holy grailtable[ ' key=>value (normal usagev ' [key for (keyvaluein table items(if value = ['holy grail'[key for key in table keys(if table[key= ['holy grail'value=>key ditto note that both of the last two commands return list of titlesin dictionariesthere' just one value per keybut there may be many keys per value given value may be stored under multiple keys (yielding multiple keys per value)and value might be collection itself (supporting multiple values per keyfor more on this frontalso watch for dictionary inversion function in ' mapattrs py example--code that would surely stretch this preview past its breaking point if included here for this purposeslet' explore more dictionary basics dictionary usage notes dictionaries are fairly straightforward tools once you get the hang of thembut here are few additional pointers and reminders you should be aware of when using themsequence operations don' work dictionaries are mappingsnot sequencesbecause there' no notion of ordering among their itemsthings like concatenation (an ordered joiningand slicing (extracting contiguous sectionsimply don' apply in factpython raises an error when your code runs if you try to do such things assigning to new indexes adds entries keys can be created when you write dictionary literal (embedded in the code of the literal itself)or when you assign values to new keys of an existing dictionary object individually the end result is the same keys need not always be strings our examples so far have used strings as keysbut any other immutable objects work just as well for instanceyou can use integers as keyswhich makes the dictionary look much like list (when indexingat leasttuples may be used as dictionary keys tooallowing compound key values --such as dates and ip addresses--to have associated values user-defined class instance objects (discussed in part vican also be used as keysas long as they have the proper protocol methodsroughlythey need to tell python that their values are "hashableand thus won' changeas otherwise they would be useless as fixed keys mutable objects such as listssetsand other dictionaries don' work as keysbut are allowed as values lists and dictionaries