structured typesmutabilityand higher-order functions when for statement is used to iterate over dictionarythe value assigned to the iteration variable is keynot key/value pair for examplethe code keys [for in monthnumberskeys append(ekeys sort(print keys prints [ 'apr''feb''jan''mar''may'dictionaries are one of the great things about python they greatly reduce the difficulty of writing variety of programs for examplein figure we use dictionaries to write (pretty horribleprogram to translate between languages etof {'bread':'pain''wine':'vin''with':'avec'' ':'je''eat':'mange''drink':'bois''john':'jean''friends':'amis''and''et''of':'du','red':'rouge'ftoe {'pain':'bread''vin':'wine''avec':'with''je':' ''mange':'eat''bois':'drink''jean':'john''amis':'friends''et':'and''du':'of''rouge':'red'dicts {'english to french':etof'french to english':ftoedef translateword(worddictionary)if word in dictionary keys()return dictionary[wordelif word !''return '"word '"return word def translate(phrasedictsdirection)ucletters 'abcdefghijklmnopqrstuvwxyzlcletters 'abcdefghijklmnopqrstuvwxyzletters ucletters lcletters dictionary dicts[directiontranslation 'word 'for in phraseif in lettersword word elsetranslation translationtranslateword(worddictionaryc word 'return translation translateword(worddictionaryprint translate(' drink good red wineand eat bread 'dicts,'english to french'print translate('je bois du vin rouge 'dicts'french to english'figure translating text (badlythe code in the figure printsje bois "goodrouge vinet mange pain drink of wine red like listsdictionaries are mutable soone must be careful about side effects for example