dictionaries looping looping through dictionaries is similar to looping through lists here is an example that prints the keys in dictionaryfor key in dprint(keyhere is an example that prints the valuesfor key in dprint( [key]lists of keys and values the following table illustrates the ways to get lists of keys and values from dictionary it uses the dictionary ={' ': ,' ': statement result description list( [' ',' 'keys of list( values()[ , values of list( items()[(' ', ),(' ', )(key,valuepairs of the pairs returned by items are called tuples tuples are lot like lists they are covered in section here is use of items to find all the keys in dictionary that correspond to value of ' ': ' ': ' ': [ [ for in items(if [ ]== 'ac dict the dict function is another way to create dictionary one use for it is kind of like the opposite of the items methodd dict([' ', ),' ', )]this creates the dictionary {' ': ,' ': this way of building dictionary is useful if your program needs to construct dictionary while it is running dictionary comprehensions dictionary comprehensions work similarly to list comprehensions the following simple example creates dictionary from list of wordswhere the values are the lengths of the wordsd { len(sfor in words counting words we can use dictionaries to count how frequently certain words appear in text