Write a Python function to find sum of all items in a Dictionary


Topic: Write a Python function to find sum of all items in a Dictionary

Solution

def returnSum(dict): 
    
    sum = 0
    for i in dict.values(): 
        sum = sum + i 
    
    return sum
dict = {'a': 100, 'b':200, 'c':300} 
print("Sum :", returnSum(dict)) 



List all Python Programs