1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vlad [161]
3 years ago
11

Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map province

s or states to their respective capitals, create a new dictionary that combines these three dictionaries, and associate it with a variable, nafta_capitals.
Python 3
Computers and Technology
1 answer:
Nookie1986 [14]3 years ago
4 0

Answer:

The Python code to combine the three dictionaries are is given as follows:

  1. canadian_capital = {
  2.    cash: "SOME VALUES",
  3.    assets: "SOME VALUES"
  4. }
  5. mexican_capital = {
  6.    cash: "SOME VALUES",
  7.    assets: "SOME VALUES"
  8. }
  9. us_capital = {
  10.    cash: "SOME VALUES",
  11.    assets: "SOME VALUES"
  12. }
  13. nafta_capital = {
  14.    canadian: canadian_capital,
  15.    mexican : mexican_capital,
  16.    us: us_capital
  17. }

Explanation:

<u>Line 1 - 14 :</u>

Create three Python dictionaries and name them as <em>canadian_capitals, mexican_capital </em>and<em> us_capitals</em>. Please note a Python dictionaries should be enclosed in curly braces { }.  

We just define two samples of relevant keys (<em>cash </em>and <em>asset</em>) in each of the dictionaries. Python dictionary can map a key to a value.

Since we are not given any capital values from the question,  a dummy string "<em>SOME VALUES</em>" is tentatively set as the value for each of the keys.

In practice, we should replace those dummy strings with the real values of capital. The values can be a number, a string, a list and even a nested dictionary.

<u>Line 16 - 20 : </u>

Create one more Python dictionary and name it as <em>nafta_capital</em>.

Since our aim is to combine the three previous dictionaries (<em>canadian_capitals, mexican_capital </em>and <em>us_capitals</em>) and associate it with <em>nafta_capital</em>, we can define three different keys (<em>canadian, mexican </em>and <em>us</em>) in our dictionary nafta_capital.

As mentioned, a value associated with a key can be a nested dictionary. Hence, we just map <em>canadian_capitals, mexican_capital </em>and <em>us_capitals</em> as the value of the keys (<em>canadian, mexican </em>and<em> us</em>) in dictionary<em> nafta_capital,</em> respectively,

By doing so, we have managed to combine three target dictionaries (<em>canadian_capitals, mexican_capital </em>and <em>us_capitals</em> ) into a single dictionary, <em>nafta_capital</em>.

You might be interested in
The Circle of Growth
larisa86 [58]

Answer:

B

Explanation:

it shows you your weaknesses so you can work on them so you can find your way to success

5 0
3 years ago
1. Text that is located between and appears in the browser's
aniked [119]

Answer:

huh?

Explanation:

3 0
3 years ago
A flat panel detector’s detector element size determines what?
Nastasia [14]

Answer:

A flat panel detector’s detector element size determines Spatial resolution.

7 0
3 years ago
f the copyright date on the homepage is more than 1 year old, the website should always be considered unmaintained
Lilit [14]
We still have moderators who watch the site every day they are in the process of acquiring a new one 
4 0
3 years ago
Write the complete class declaration for the class Advance. Include all necessary instance variables and implementations of its
Maru [420]

Answer:

Explanation:

The following Java code creates both the Advance class and Student Advance class. The StudentAdvance class extends the Advance class and uses its constructor to always be up to date even when there are changes in the Advance class. Due to technical difficulties I have attached the code as a txt file below.

4 0
3 years ago
Other questions:
  • After a conditional formatting rule is created using the ____ dialog box, the rule is then available for use in the database fro
    11·1 answer
  • Write a program that will use user input. The program should be called PrintNumberToWordie which prints "ONE", "TWO",..., "FIVE"
    9·1 answer
  • An _____ is a set of directions for carrying out a task.
    14·1 answer
  • What did the Copernican revolution demonstrate?
    15·1 answer
  • Rate monotonic Analysis (RMA) is a model for predicting whether or not a system will meet its timing as well as throughput requi
    6·1 answer
  • Convert 42DB5000 base 16 to base 10 floating point form assuming this is a signed floating point encoding (IEEE754) (32-Bit)
    10·1 answer
  • What is the easiest way to defeat ganon in BOTW?
    11·2 answers
  • Gourmet pizza shop with a
    6·1 answer
  • In cell K10, create a formula using the SUM function that calculated the total of the range F17:F20 subtracts it from the value
    5·1 answer
  • you have just finished developing a new application. before putting it on the website for users to download, you want to provide
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!