'Sum the nth value for every key in a python dictionary [closed]
EDIT
I have the following dictionary:
dictionary = {'abc': [20, 'john'], 'def': [25, 'jim'], 'ghi': [30, 'jack']}
I would like to sum all of the first values for each key and define it as a variable
Expected answer:
20 + 25 + 30
total_score = 75
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
