Sum of Dictionary items – Simple Python Program

This is to demonstrate how “dictionary” is used in Python. Name:Value – pairs.

d={'m1':80,'m2':86,'m3':87,'m4':90,'m5':95}
sum=d['m1']+d['m2']+d['m3']+d['m4']+d['m5']
print('The sum of the dictionary values',d,' are ',sum)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.