## Tuesday, September 29, 2020

Solution Exercise 118 : python algorithm to add the scores average in a dictionary scores #### Exercise 118

The following dictionary contains a student's math scores:
``scores = {'score1' : 16, 'score2' : 14, 'score3' : 17}``
update the notes dictionary by adding the average of scores.

#### Solution

``````scores = {'score1' : 16, 'score2' : 14, 'score3' : 17}

# initializing the average of scores
average = 0
# browsing through all items in dictionary
for key , value in scores.items():
average = average + scores[key]
average = average/3
scores['avaerage'] = average

# Testing program
print("The updated dictionary is : scores = " , scores)
# display : The updated dictionary is : scores =  {'score1': 16, 'score2': 14, 'score3': 17, 'avaerage': 15.666666666666666}
``````
All Python Dictionary Exercises

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 