homework5git/lists/grades02.py

16 lines
418 B
Python

#!/usr/bin/python3
# grades02
# List element manipulation.
scores = [75, 95, 90, 87, 99, 100, 97, 100]
numberOfScores = len(scores)
# We will sum the scores. Initialize sum value to zero then add each value to the sum.
sum = 0
for score in scores:
sum = sum + score
print(f"The sum of the {numberOfScores} scores is {sum:.2f}")
print(f"The average of the {numberOfScores} scores is {sum/numberOfScores:.2f}")