Ask Question
25 March, 06:27

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.

+1
Answers (1)
  1. 25 March, 07:20
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers