# create a mapping of state to abbreviationstates = {‘Oregon‘: ‘OR‘,‘Florida‘: ‘FL‘,‘California‘: ‘CA‘,‘New York‘: ‘NY‘,‘Michigan‘: ‘MI‘ }# create a basic set of states and some cities in themcities = {‘CA‘: ‘San Francisco‘,‘MI‘: ‘Detroit‘,‘FL‘: ‘Jacksonville‘ }# add some more citiescities[‘NY‘] = ‘New York‘cities[‘OR‘] = ‘Portland‘# print out some citiesprint ‘-‘ * 10print "NY State has: ", cities[‘NY‘]print "OR State has: ", cities[‘OR‘]# print some statesprint ‘-‘ * 10print "Michigan‘s abbreviation is: ", states[‘Michigan‘]print "Florida‘s abbreviation is: ", states[‘Florida‘]# do it by using the state then cities dictprint ‘-‘ * 10print "Michigan has: ", cities[states[‘Michigan‘]]print "Florida has: ", cities[states[‘Florida‘]]# print every state abbreviat
A = dict. Get ('A', 'default ')
If 'A' exists, print the value of 'A'; else print default value.
Exercise 39: dictionaries, Oh lovely dictionaries