Page 324 - Beginning Programming with Pyth - John Paul Mueller
P. 324
You verify that Sam’s entry is actually gone. 12. Type len(Colors) and click Run Cell.
The output value of 3 verifies that the dictionary contains only three entries now, rather than 4.
13. TypeColors.clear( )andpressEnter.
14. Type len(Colors) and click Run Cell.
Python reports that Colors has 0 entries, so the dictionary is now empty.
FIGURE 14-5: A dictionary places entries in sorted order.
FIGURE 14-6: Dictionaries make value access easy and self-documenting.
FIGURE 14-7: You can ask a dictionary for a list of keys.
FIGURE 14-8: You can create useful keys to output information with greater ease.