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
Donna is a graphic designer working on a poster for a music concert. What is her objective?
Marina86 [1]

Answer:her objetive is to impress the public with the poster.

Explanation:

The poster have to be about the music. It is very important for the singer or the festival.

The objetive is going on with the festival, with the music and with the concert’s style.

It’s a personal design. But it have to be original for every design.

3 0
3 years ago
Read 2 more answers
Hidden-surface removal is the process of:
castortr0y [4]

Answer:

Option A.

Explanation:

In 3D computer graphics, this process determines which elements should not be visible from the desired point of view, and will prevent them from rendering. Thus, objects that lie behind opaque surfaces such as walls or panels, will not be rendered.

A good rendering algorithm helps to optimize the graphic engine because it will load as few elements as possible. Therefore, in larger worlds, the engine will remain at a stable speed and will be more efficient.

3 0
3 years ago
Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in t
artcher [175]

Answer:

Explanation:

The following Python program uses a combination of dictionary, list, regex, and loops to accomplish what was requested. The function takes a file name as input, reads the file, and saves the individual words in a list. Then it loops through the list, adding each word into a dictionary with the number of times it appears. If the word is already in the dictionary it adds 1 to its count value. The program was tested with a file named great_expectations.txt and the output can be seen below.

import re

def wordCount(fileName):

   file = open(fileName, 'r')

   wordList = file.read().lower()

   wordList = re.split('\s', wordList)

   wordDict = {}

   for word in wordList:

       if word in wordDict:

           wordDict[word] = wordDict.get(word) + 1

       else:

           wordDict[word] = 1

   print(wordDict)

wordCount('great_expectations.txt')

4 0
3 years ago
What is mean by sole trading concern?​
DENIUS [597]

Answer:

trading as a whole

Explanation:

pls give brainlest almost lvled up.

6 0
3 years ago
TRUE/FALSE QUESTIONS: T F 1. An intruder can also be referred to as a hacker or cracker. T F 2. Activists are either individuals
Law Incorporation [45]

Answer:

1. True 2. False 3. True 4. True 5. True 6. False 7. True

Explanation:

1.  A hacker/cracker finds and exploits weakness in order to gain access with a criminal intent, just as an intruder.

2. Activists are people who campaign to bring about a positive political or social change.

3. It is illegal to use a device as a packet sniffer to steal people's usernames and passwords.

4. This quite true, as there is a huge community of hackers where people are highly recognized for hacking.

5. Yes, intruders have a common attack methodology.

6. IDS monitors networks or systems to identify suspicious activities while a user interface is the means the computer and the user interacts. So it's false.

7. instrusion detection involves monitoring networks or systems to identify suspicious activities, so an intruder is detected if their behavior is suspicious when compared to a legitimate user.

5 0
3 years ago
Other questions:
  • Choose all statements that identify the benefits of programming design.
    10·2 answers
  • The process of changing a program’s internal structure without changing the way the program works is ______________.
    13·1 answer
  • A ________ is a collection of forms, reports, queries, and programs that serves as an intermediary between users and database da
    6·1 answer
  • Help!!!! ASAP TIMED TEST 50 points!!!!
    7·1 answer
  • The purpose of maintaining a network of digital forensics specialists is to develop a list of colleagues who specialize in areas
    7·2 answers
  • Write a programme with C++ language wich print the biggest number in between three numbers , whith INT
    14·1 answer
  • Two different applications that make use of the barcode
    5·1 answer
  • Indica si los elementos de las imagenes son una materia prima o un material elaborado
    12·1 answer
  • Amy uses digital devices to listen to music and to watch movies. Which one of these is Mbps a measure of?
    12·1 answer
  • In what machines, places and apparatus are dimmers used in? Put at least 5 examples
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!