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
if you want to open up your desktop computer to look inside what is one of the first things you should do
Sunny_sXe [5.5K]
Turn it on or open the laptop
7 0
4 years ago
Can you guys help me with this coding assignments?
kicyunya [14]

Explanation:

x ==50

while x< 100;

x -= 1

8 0
3 years ago
Which of the following is computer memory that works while the computer is turned on?
Crazy boy [7]

Answer:

Ron is the answer

Explanation:

In that sense it is similar to secondary memory, which is used for long term storage. When a computer is turned on, the CPU can begin reading information stored in ROM without the need for drivers or other complex software to help it communicate.

5 0
3 years ago
What is a free and compatible alternative to the Microsoft Office Suite (word processing, spreadsheets, and calendars)?
Akimi4 [234]

Answer:

Open Office

Explanation:

Open Office may be regarded as an open source productivity tool which allows users to enjoy the ability to create and edit documents similar to Microsoft Word, create spreadsheet files and documents similar to Microsoft excel and Presentation tool similar to Microsoft PowerPoint. With the open source category of open office, it means it is a free software whereby users can enjoy these tools without having to purchase any user license. The other tools in the option such as Notepad, Lotus note do not posses all these functionality.

6 0
3 years ago
Question # 3
NeX [460]

what not understanding

4 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) ____ is a named collection of data that exists on a storage medium.
    7·1 answer
  • What happens once the Insert tab is used in PowerPoint to insert a chart into a presentation?
    7·1 answer
  • The primary function of the average command is what?
    15·1 answer
  • In most languages, if a file does not exist and a program attempts to open it in append mode, what happens?
    12·1 answer
  • In reference to computer communications, what does the term noise mean?
    8·2 answers
  • Cryptography has requirements include:
    8·1 answer
  • In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
    9·2 answers
  • In a PC, which of the following components stores the BIOS
    6·1 answer
  • What happens when there is a data fail?
    6·2 answers
  • The which command _________________. a. can only be used to search for executables b. searches for a file in all directories sta
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!