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
Setler79 [48]
3 years ago
12

Define a function below, sum_numeric_vals, which takes a single dictionary as a parameter. The dictionary has only strings for k

eys, but can have string or integer values. Complete the function to calculate and return the sum of the integer values in the dictionary.
Computers and Technology
1 answer:
notka56 [123]3 years ago
3 0

Answer:

Following are the program in the Python Programming language.

#define function

def sum_numeric_vals(dic):

 #set and initialize the integer variable to 0

 sum_total = 0

 #set the for loop to extract the value of dictionary

 for val in dic.values():

   #set if condition to find the sum

   if type(val)==int:

     sum_total += val

 #return the sum of the values

 return sum_total

#set and initialize dictionary type variable

dic={"Two":2,"Four":4}

#call and print the function

print(sum_numeric_vals(dic))

<u>Output:</u>

6

Explanation:

Here, we define the function "sum_numeric_vals()" and pass an argument "dic", inside the function.

  • Set and initialize an integer data type variable "sum_total" to 0.
  • Set the for loop which extract the values of the dictionary.
  • Set the if conditional statement inside the loop to find the sum of the values of the dictionary.
  • Then, return the sum of the values of the dictionary.

Finally, we set and initialize the dictionary type variable "dic" and pass it in the function's argument list then, call the function through the print function

You might be interested in
What are the methods of gilding<br><br>nonsense will be immediately reported. ​
Luden [163]
Methods of gilding include hand application and gluing, typically of gold leaf, chemical gilding, and electroplating, the last also called gold plating. Parcel-gilt (partial gil) objects are only gilded over part of their surfaces.
6 0
1 year ago
Which view is most often used to reorder slides in a presentation that has already been created?
riadik2000 [5.3K]

Answer:

Normal view

Explanation:

The normal view is best used because it is just to drag and drop

4 0
2 years ago
Read 2 more answers
Assume you're using a three-button mouse. To access shortcut menus, you would
irina1246 [14]
If you are using the three-button mouse, in order to access the shortcut menus, you would right click the mouse. 
If you right click your mouse, it will show shortcut menus that can be easily accessed.
5 0
2 years ago
How does a firewall provide network security
ehidna [41]
Firewalls are connected with a network device which blocks untrusted network forming a barrier in between trusted and un-trusted network.
8 0
3 years ago
Function prototypes and function definitions look similar because they have the same function heading. In a function prototype t
hjlf

Answer:

In a function prototype the heading is followed by a semicolon, whereas in a function definition the heading is followed by a function block.

Explanation:

As the function prototype only declares the function and the function definition defines the operations in the function.

e.g:

add(int x, int y);  is the prototype

add(int x, int y)

{

     int sum;

     sum = x+y;

}    is the function definition.

3 0
2 years ago
Other questions:
  • Why does the PC send out a broadcast ARP prior to sending the first ping request
    12·1 answer
  • Each tab is divided into groups of related commands or buttons. T or F
    10·1 answer
  • Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in
    14·1 answer
  • Before measuring resistance of a component, be sure:
    8·1 answer
  • Use Spreadsheet Functions and Formulas
    6·1 answer
  • What is keyboard? answer me <br>​
    12·2 answers
  • Who invented computer ?​
    9·2 answers
  • There are many ways you can improve the performance of a website from an SEO perspective. When it comes to link building, which
    15·1 answer
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    11·1 answer
  •  A programming paradigm is a method used to program a computer that guides the solving of a problem or performing of a task. Whi
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!