Ask Question
22 February, 18:54

Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map provinces or states to their respective capitals, create a new dictionary that combines these three dictionaries, and associate it with a variable, nafta_capitals.

+5
Answers (1)
  1. 22 February, 19:44
    0
    The Python code is explained below

    Explanation:

    #Define the dictionary

    #canadian_capitals.

    canadian_capitals = {

    'Alberta': 'Edmonton',

    'British Columbia': 'Victoria',

    'Ontario': 'Toronto',

    'Manitoba': 'Winnipeg'

    }

    #Define the dictionary

    #mexican_capitals.

    mexican_capitals = {

    'Puebla': 'Puebla',

    'Sonora': 'Hermosillo',

    'Tabasco': 'Villahermosa',

    'Hidalgo': 'Pachuca'

    }

    #Define the dictionary

    #us_capitals.

    us_capitals = {

    'Alabama': 'Montgomery',

    'Alaska': 'Juneau',

    'Georgia': 'Atlanta',

    'California': 'Sacramento'

    }

    #De-hash the values of

    #the dictionaries using

    #the * *operator and add them

    #to the dictionary nafta_capitals.

    nafta_capitals = {**canadian_capitals, * *mexican_capitals, * *us_capitals}

    #Print the dictionary

    #nafta_capitals.

    print (nafta_capitals)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map provinces or states ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers