Question: Paste this code into a new file and find the errors. Entering scores of 44, 55, and 66 should give an average of 60.5. #
Paste this code into a new file and find the errors. Entering scores of 44, 55, and 66 should give an average of 60.5.
# This program gets a series of test scores and
# calculates the average of the scores with the
# lowest score dropped.
def main():
# Get the test scores from the user.
scores = get_scores()
# Get the total of the test scores.
total = get_total(scores)
# Get the lowest test score.
lowest = min(scores)
# Subtract the lowest score from the total.
total -= lowest
# Calculate the average. Note that we divide
# by 1 less than the number of scores because
# the lowest score was dropped.
if len(scores) <= 1:
print('There are not enough scores to calculate an average.')
else:
average = total / (len(scores))
# Display the average.
print('The average, with the lowest score dropped', \
'is:', average)
# The get_scores function gets a series of test
# scores from the user and stores them in a list.
# A reference to the list is returned.
def get_scores():
# Create an empty list.
test_scores = []
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
