Exercise for reference:

Calculate the sum of all dictionary values.

d = {"a": 1, "b": 2, "c": 3}

Answer:

d = {"a": 1, "b": 2, "c": 3}
print(sum(d.values()))

Explanation:

d.values() returns a list-likedict_values object while the sum function calculates the sum of thedict_values items.