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 linear programming ingredient or blending problem model allows one to include not only the cost of the resource, but also th
Svetach [21]

Answer: True

Explanation:

Blending problem model applications are typical of Mixed Integer-Linear Programming (MILP).

They allow to demand satisfaction of blending several resources or materials to create products and allow one to include not only the cost of the resource, but also the differences in composition.

6 0
2 years ago
"what type of index has an index key value that points to a data row, which contains the key value? "
Ira Lisetskai [31]
The nonclustered index is a <span>type of index that has an index key value that points to a data row, which contains the key value.
</span><span>This index has a structure separate from the data rows and contains index key values and each key value entry has a pointer to the data row that contains the key value.
</span><span>Clustered indexes on the other hand sort and store the data rows in the table or view based on their key values.</span>
8 0
3 years ago
Which of these files when included in a program will provide user assistance?
olya-2409 [2.1K]
What are the options for this answer? 
8 0
3 years ago
Read 2 more answers
Which of the following statements about the use of desktop publishing software is true
VLD [36.1K]
What did you do when you got to school tomorrow and then again I don't want it
4 0
2 years ago
How is the Internet Simulator similar to the Actual Internet? How is it different?
masya89 [10]
The Internet Simulator is a tool developed by Code.org for our new high school Computer Science Principles class. ... The Internet Simulator was designed to be used in a classroom with students working collaboratively in-person to solve problems.
4 0
3 years ago
Other questions:
  • Liz will use a CD-R compact disk to write to more than once. Carlo will use a CD-RW compact disk to write to more than once. Who
    8·2 answers
  • true /falseCompression of entries in the term-document matrix can be used to reduce run-time storage and execution-time requirem
    10·1 answer
  • Chdtp aoxophg gr72 ae9&gt;3 zqqz
    12·1 answer
  • BOTH INTERNATIONAL &amp; INLAND Which procedure(s) shall be used to determine risk of collision?
    14·1 answer
  • In java Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex:
    7·1 answer
  • Difference between positional and non positional number​
    12·1 answer
  • Which programming language represents data in the form of a series of zeros and ones​
    7·1 answer
  • Que es tarjeta madre resumen porfa
    13·2 answers
  • Something I should look for when trying to decide if a source is credible is the publication's ....
    10·1 answer
  • reagan's firm has not had to make large investments in computer or networking hardware or in personnel to maintain the hardware
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!