but is presented here in the context of extensions because of its origin with that in mindlet' take look at what' new in dictionaries in and dictionary comprehensions in and as mentioned at the end of the prior sectiondictionaries in and can also be created with dictionary comprehensions like the set comprehensions we met in dictionary comprehensions are available only in and (not in and earlierlike the longstanding list comprehensions we met briefly in and earlier in this they run an implied loopcollecting the key/value results of expressions on each iteration and using them to fill out new dictionary loop variable allows the comprehension to use loop iteration values along the way to illustratea standard way to initialize dictionary dynamically in both and is to combine its keys and values with zipand pass the result to the dict call the zip built-in function is the hook that allows us to construct dictionary from key and value lists this way--if you cannot predict the set of keys and values in your codeyou can always build them up as lists and zip them together we'll study zip in detail in and after exploring statementsit' an iterable in xso we must wrap it in list call to show its results therebut its basic usage is otherwise straightforwardlist(zip([' '' '' '][ ])[(' ' )(' ' )(' ' )zip together keys and values dict(zip([' '' '' '][ ]) {' ' ' ' ' ' make dict from zip result in python and thoughyou can achieve the same effect with dictionary comprehension expression the following builds new dictionary with key/value pair for every such pair in the zip result (it reads almost the same in pythonbut with bit more formality) {kv for (kvin zip([' '' '' '][ ]) {' ' ' ' ' ' comprehensions actually require more code in this casebut they are also more general than this example implies--we can use them to map single stream of values to dictionaries as welland keys can be computed with expressions just like valuesd {xx * for in [ ] { orrange( {cc for in 'spam'loop over any iterable {' ''ssss'' ''pppp'' ''aaaa'' ''mmmm'dictionaries in action