Sum Values || Python
Sum Values
For the first code challenge, we are going to look at only the values in a dictionary. This function should sum up all of the values from the key-value pairs in the dictionary. Here are the steps we need:
Write a function named sum_values that takes a dictionary named my_dictionary as a parameter. The function should return the sum of the values of the dictionary
We start by creating a variable to keep track of the total. Next, we use the values() function in our for loop in order to iterate through each of the values in the dictionary. Using this, we can access each value and add it to our total variable. At the end of our loop, we return the total.