the dictionaries we createthe get methoda conditional index with defaultthe python has_key methodan in work-alike that is no longer available in xthe try statementa tool we'll first meet in that catches and recovers from exceptions altogetherand the if/else ternary (three-partexpressionwhich is essentially an if statement squeezed onto single line here are few examplesvalue get(' ' value value [' 'if 'xin else value index but with default if/else expression form we'll save the details on such alternatives until later for nowlet' turn to another dictionary method' role in common use case sorting keysfor loops as mentioned earlierbecause dictionaries are not sequencesthey don' maintain any dependable left-to-right order if we make dictionary and print it backits keys may come back in different order than that in which we typed themand may vary per python version and other variablesd {' ' ' ' ' ' {' ' ' ' ' ' what do we dothoughif we do need to impose an ordering on dictionary' itemsone common solution is to grab list of keys with the dictionary keys methodsort that with the list sort methodand then step through the result with python for loop (as for ifbe sure to press the enter key twice after coding the following for loopand omit the outer parenthesis in the print in python )ks list( keys()ks [' '' '' 'unordered keys list list in "viewin xuse list(ks sort(ks [' '' '' 'sorted keys list for key in ksprint(key'=>' [key]iterate though sorted keys <=press enter twice here ( printa = = = this is three-step processalthoughas we'll see in later in recent versions of python it can be done in one step with the newer sorted built-in function the introducing python object types