![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to sum values of a Python dictionary?
It is pretty easy to get the sum of values of a Python dictionary. You can first get the values in a list using the dict.values(). Then you can call the sum method to get the sum of these values.
example
d = { 'foo': 10, 'bar': 20, 'baz': 30 } print(sum(d.values()))
Output
This will give the output −
60
Advertisements