Can you please help me with write a python program to read five scores and output the average score and also output the amount by which that score differes from the average.

I have done the average part but I don't know how to get the difference of all the scores from average. Please help.

Total_exam = 0
for n in range(5):
score = float(input("Enter a score:"))
Total_exam = Total_exam + score      #for average calculation

#using average formula to calculate average
avg = Total_exam/5
print("The average score is", avg)

You'll have to create a list to hold all five numbers so that you can iterate over the list after the numbers have all been read in. When you iterate over the list you can, at that point, calculate and display how much each score differs from the average.

commented: Can you please give me some idea on how to start to get the difference of each score from average. thanks +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.