YouTip LogoYouTip

Python Sum Dictionary

# Python3.x Python Calculate Sum of Dictionary Values [![Image 3: Document Object Reference](#) Python3 Examples](#) Given a dictionary, then calculate the sum of all their numeric values. ## Example def returnSum(myDict): sum = 0 for i in myDict: sum = sum + myDictreturn sum dict = {'a': 100, 'b':200, 'c':300} print("Sum :", returnSum(dict)) Executing the above code outputs the following result: Sum : 600 [![Image 4: Document Object Reference](#) Python3 Examples](#)
← Python Merging Two DictionarieArrays Equal β†’