“Python Sum Dictionary Values ​​By Key” Kode Jawaban

Jumlah Semua Nilai Kamus Python

sum(dictionary.values())
Smoggy Serval

Python Sum Dictionary Values ​​By Key

example_list = [
    {'points': 400, 'gold': 2480},
    {'points': 100, 'gold': 610},
    {'points': 100, 'gold': 620},
    {'points': 100, 'gold': 620}
]
sum(item['gold'] for item in example_list)
Edi Sugiarto

Jawaban yang mirip dengan “Python Sum Dictionary Values ​​By Key”

Pertanyaan yang mirip dengan “Python Sum Dictionary Values ​​By Key”

Lebih banyak jawaban terkait untuk “Python Sum Dictionary Values ​​By Key” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya