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