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
ryzh [129]
3 years ago
8

1. Implement the function dict_intersect, which takes two dictionaries as parameters d1 and d2, and returns a new dictionary whi

ch contains only those keys which appear in both d1 and d2, whose values are a tuple of the corresponding values from d1 and d2.
E.g., dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'}) should return {'b': ('banana', 'bee')}

2. Implement the function consolidate, which accepts zero or more sequences in the star parameter seqs, and returns a dictionary whose keys consist of values found in those sequences, which in turn map to numbers indicating how many times each value appears across all the sequences.

E.g., consolidate([1,2,3], [1,1,1], [2,4], [1]) should return the dictionary {1: 5, 2: 2, 3: 1, 4: 1}.
Computers and Technology
1 answer:
stich3 [128]3 years ago
5 0

Answer:

1  

def dict_intersect(d1,d2): #create dictionary

  d3={} #dictionaries

  for key1,value1 in d1.items():       #iterate through the loop  

      if key1 in d2:   #checking condition

          d3[key1]=(d1[key1],d2[key1])   #add the items into the dictionary  

  return d 3

print(dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'})) #display

2

def consolidate(*l1):  #create consolidate

  d3={} # create dictionary

  for k in l1:       #iterate through the loop

      for number in k:   #iterate through  the loop                               d3[number]=d3.get(number,0)+1   #increment the value

             return d 3 #return

print(consolidate([1,2,3], [1,1,1], [2,4], [1])) #display

Explanation:

1

Following are  the description of program

  • Create a dictionary i.e"dict_intersect(d1,d2) "   in this dictionary created a dictionary d3 .
  • After that iterated the loop and check the condition .
  • If the condition is true then add the items into the dictionary and return the dictionary d3 .
  • Finally print them that are specified in the given question .

2

Following are  the description of program

  • Create a dictionary  consolidate inside that created a dictionary "d3" .
  • After that iterated the loop outer as well as inner loop and increment the value of items .
  • Return the d3 dictionary and print the dictionary as specified in the given question .

You might be interested in
What is your idea for creating a new and fresh Gaming experience around viewing occasions for Mike's?
Whitepunk [10]

My idea on creating a new and fresh Gaming experience around viewing occasions is that one should incorporate emotions into games that people around  around viewing occasions can feel.

<h3>What is a gaming experience?</h3>

Gaming is known to be that experience or one can say the origin of identity and also the community that is made for gamers.

Note that the experience is one that goes far more than the game itself, and as such, My idea on creating a new and fresh Gaming experience around viewing occasions is that one should incorporate emotions into games that people around  around viewing occasions can feel.

Learn more about Gaming experience from

brainly.com/question/27355039

#SPJ1

6 0
2 years ago
A device that is connected to the Internet is known as<br> a. Nexus. Backbone. Node. Link.
ikadub [295]
A device connected to the internet is known as a Node.
3 0
3 years ago
Read 2 more answers
Is ryzen really better for all-around purpose, and intel is better for gaming?
barxatty [35]

Answer:

Its really personal preference G.

Explanation:

But what you said is about right.

6 0
3 years ago
What does the term "technical skills" refer to and how do they help in the field of computers?
noname [10]
Technical skills is when you are advanced or know lots in Electronics. You are able to diagnose problems and fix them. They help in the computer field so much because they help fix everything if no one had these skills we wouldn’t be able to even use brainly
8 0
3 years ago
File names should describe what is in the file in a few words
JulijaS [17]

Answer

File names should describe the content of the file.

Explanation

File names are set of words  which are used to uniquely identify computer files which are stored in a file system. This helps one to know the contents of the file which you want to find. When you name these file names you use necessary characters you use descriptive words so that you dont have hard times when searching for them. The naming also is determined by the file system you are using because different systems impose different restrictions on the length of the file names and the allowed characters within file names.

3 0
3 years ago
Other questions:
  • What type of link is used to call this file
    11·1 answer
  • Name three types of data stored on a computer’s hard disk
    11·1 answer
  • Write a function called lucky_sevens that takes in one #parameter, a string variable named a_string. Your function #should retur
    15·1 answer
  • A technician removes the cap from the brake fluid reservoir and finds that the rubber boot in the cap is swollen. technician a s
    8·1 answer
  • . Each ____ on a menu performs a specific action.
    14·1 answer
  • Write a Java class with the following methods: getArray(int numStrings) is an instance method that takes command line input (use
    11·1 answer
  • A surface
    6·1 answer
  • What your favorite video game? (Put your user if you wanna play!)
    9·2 answers
  • Write any two merits and demerits of computer​
    8·1 answer
  • One word for The characters typed by a user using a<br> keyboard.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!