Question: in python please : A friend of yours has written a Python program and they have asked you to help debug it. It is supposed

in python please :

A friend of yours has written a Python program and they have asked you to help debug it. It is supposed to read and analyze a bunch of test scores. Unfortunately this program is not accomplishing all of these tasks.

The program needs to determine the total of all test scores, determine the average, print the sum of all test scores and print the average of all test scores.

Find the 5 bugs in this program. As you find each bug, place a comment in the code explaining what you did to fix the program code. Put the number of the fix in the comment. For example: # Fix 1: Added a call to main

#This program was meant to load a series of test scores into an array.

#Once in the array the program needed to determine the Total of all of the

#scores and the Average. It then needed to print the Total and Average

#to the user. Summer 2018.

def DetermineTotalScores(TestScores):

#declare local variables

Index = int()

OneScore = float()

Total = float()

#Calculate Total

for Index in range(0, len(TestScores)):

OneScore = TestScores[Index]

Total = OneScore + Total

#end for

def DetermineAverage(TotalScore, TestScores):

#declare local variables

NumScores = int()

Average = float()

#determine Total number of scores in test scores array

NumScores = len(TestScores)

#determine Average

Average = TotalScore/NumScores

return Average

def PrintTotal():

#Print out the Total score

print("The Total score is:\t", TotalScore)

def PrintAverage(Average):

#print out the Average

print("The Average score is:\t", format(Average, ',.2f'))

def main():

#declare variables

TestScores = [0] * 5

Average = float()

TotalScore = float()

#filling test scores

TestScores = [85.5, 75.25, 88.0, 90.25, 92.0]

#Determine the Total for all of the scores

TotalScore = DetermineTotalScores()

#Determine Average

Average = DetermineAverage(TotalScore, TestScores)

#Print out Total score and Average

PrintTotal(TotalScore)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!