Add Dictionary Values

A dictionary often stores data by category, like expenses by day or player scores. The function sum_dict_values receives a dictionary d and adds together all its numeric values. If the dictionary is empty, the total should be 0.

Примеры

Ввод
{"a": 1, "b": 2, "c": 3}
Вывод
6
Ввод
{}
Вывод
0
Ввод
{"x": 10}
Вывод
10

Нужно реализовать

def sum_dict_values(d: dict) -> int:

Теги

dictmath
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
{"a":1,"b":2,"c":3}
Expected6
2
Input
{}
Expected0
3
Input
{"x":10}
Expected10
4
Input
{"a":-1,"b":1}
Expected0
5
Input
{"p":5,"q":5}
Expected10
6
Input
{"b":2,"c":3}
Expected5
Focus radio
Paused · SomaFM · Fluid