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
diamong [38]
3 years ago
8

Define a function below, get_subset, which takes two arguments: a dictionary of strings (keys) to integers (values) and a list o

f strings. All of the strings in the list are keys to the dictionary. Complete the function such that it returns the subset of the dictionary defined by the keys in the list of strings. For example, with the dictionary {"puffin": 5, "corgi": 2, "three": 3} and the list ["three", "corgi"], your function should return {"corgi": 2, "three": 3}. Since dictionaries are unordered, you can add the keys to the new dictionary in any order.
Computers and Technology
1 answer:
frozen [14]3 years ago
3 0

Answer:

The following are the program in the Python Programming Language.

#define function

def get_subset(dic,lst):

   #declare dictionary type array

   res = {}

   #set the for loop

   for a in lst:

       #set the if conditional statement

       if a in dic:

           #assign the value of 'dic' in the 'res'

           res[a] = dic[a]

   #return the variable 'res'

   return res

Explanation:

<u>The following are description of the program</u>.

  • In the above program, define the function 'get_subset()' and pass two arguments in its parameter 'dic' and 'lst'.
  • Declare dictionary type variable 'res' then, set the for loop.
  • Then, set the if conditional statement that checks the elements of the variable 'a' in the variable 'dic' and assigns the value of 'dic' in the variable 'res'.
  • Finally, return the variable 'res'.
You might be interested in
consider the following code segment, which appears in a method in a class other than password. the code segment does not compile
Romashka [77]

The code segment does not compile because the method 'reset' does not return a value that can be displayed.

A method refers to a block of that which only runs when it is called. It is permissible to pass data, referred to as parameters, into a method. Methods are used to accomplish certain actions, and they are also called functions. As per the given code segment that appears as a method in a class, it does not compile because the method named 'reset' is not returning a value that can be printed on the screen as an output.

"

<em>Complete question:</em>

Consider the following code segment, which appears in a method in a class other than password.

Password p = new Password("password");

System.out.println("The new password is " + p.reset("password"));

The code segment does not compile because _____________ .

"

You can learn more about Method at

brainly.com/question/27415982

#SPJ4

4 0
9 months ago
Select all that apply.
VARVARA [1.3K]

You can move one cell to the right by using the Tab key.

8 0
3 years ago
A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
Alinara [238K]
A1 is 10, so your answer is 10+2=12
B. 12
6 0
3 years ago
Read 2 more answers
You need to open the negative screw on the ceiling fan,what driver should you use?​
ELEN [110]

Answer:

flat screw driver

because if the screw is negative then you will need a flat screw driver

8 0
3 years ago
PARTNERING AS IT RELATES TO BPR.​
balandron [24]

Answer:

The answer to this question can be defined as follows:

Explanation:

The term BPR stands for "business processes reengineering", It is the recreating of the core business process to improve product performance or reliability or lower costs.

  • It generally includes analyzing business processes, which identifying sub-par or ineffective processes but identifying ways to dispose of or change it.
  • IT important for improving changes, especially to shift in aspects of the work, its incorporation in business operations, or competitive strength change.
  • It might contribute to making reconfiguration improvements, and is known as a BPR enabler.
6 0
3 years ago
Other questions:
  • Your network employs basic authentication that centers on usernames and passwords. However, you have two ongoing problems. The f
    13·1 answer
  • Why computers are called "COMPUTER"?
    12·1 answer
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • How did voyager 1 and voyager 2 made outer space exploration and easier
    11·1 answer
  • Which button will allow you to insert quotes and notes into text into a document​
    12·1 answer
  • Given an array of n distinct integers,d = [d[0], d[1],.., d[n - 1]], and an integer threshold, t, how many (a,b,c) index triplet
    11·1 answer
  • . Let F(X, Y, Z)=(X + Y + Z)(X + Y + Z)(X + Y + Z)(X + Y + Z). Use a 3-variable K-Map to find the minimized SOP form of this fun
    15·1 answer
  • Which of the following statements is NOT true about url extension?
    10·2 answers
  • Create a method called randomValues that uses a while loop to generate a random number between 1-25 until the value 10 is genera
    12·1 answer
  • Which of these agents of education empowers the other..........
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!