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]
4 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]4 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
Hich function would be used to remove a section of text from a document?
Westkost [7]
Highlight the text and press delete
7 0
3 years ago
How to turn off microsoft teams message notifications
Andru [333]

Answer:

simply go to settings and turn it off.

Explanation:

i can help you

first tell you use pc or mobilephone

and secondly what type of notifications? message or call or meeting

5 0
3 years ago
What is the result when you run the following program?
TiliK225 [7]

Answer:

C

Explanation:

6 0
3 years ago
Read 2 more answers
6.7 — Trickier Trap 4
Bogdan [553]

Answer:

I do not know the answer sorry

5 0
3 years ago
Read 2 more answers
Discuss 2D gameplay and how new platforms such as cell phones are taking advantages of this renewed market
ankoles [38]
2D games are games that are made in the second dimension. These games are can be any type of game from platforms like Mario or adventure games like Terraria.  These games are big in the mobile games market because they are simple due to them only having 2 dimensions. This makes it easy for the players because you either have to use a "joystick" to move the characters like in Terraria or push a button to do a certain action.<span />
8 0
3 years ago
Other questions:
  • Hen pointing to a tool on the ribbon, a ______ appears, displaying information about the tool.
    7·1 answer
  • The different between a compiler and a translaror
    9·2 answers
  • Which best describes a computer bug? A piece of computer hardware that is out of date or has a newer version a piece of computer
    14·2 answers
  • Convert binary number 11101111.10111 to decimal
    5·1 answer
  • Language/Type: Java ArrayList Collections
    6·1 answer
  • 01 Describe all the possible component of a chart​
    8·1 answer
  • A. Fill in the blanks:
    6·1 answer
  • In the chemical reaction of baking cookies, the product is?
    11·1 answer
  • When conducting memory and recall tests, some people make an effort to normalize memories by not reporting extreme cases. this l
    12·1 answer
  • What is one way to establish a team's velocity?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!