I have most of it but I can't figure out how to word the last part.
def findLargest(L):
largest = 0
for x in L:
if x > largest:
largest = x
return largest
def findSmallest(L):
smallest = 300000000
for x in L:
if x < smallest:
smallest = x
return smallest
def findAverage(L):
sum = 0.0
for x in L:
sum = sum + x
return sum/len(L)
def findLetterGrade(score):
#if (score >= 90) and (score <= 100):
if score in range(90,101):
return "A"
elif score in range(80, 90):
return "B"
elif score in range(70, 80):
return "C"
elif score in range(60, 70):
return "D"
elif score in range(1, 60):
return "F"
def countGrades(L):
countA = 0
countB = 0
countC = 0
countD = 0
countF = 0
for i in L:
if findLetterGrade(score) == "A":
countA = countA + 1
elif findLetterGrade(i) == "B":
countB = countB + 1
elif findLetterGrade(i) == "C":
countC = countC + 1
elif findLetterGrade(i) == "D":
countD = countD + 1
elif findLetterGrade(i) == "F":
countF = countF + 1
return [countA,countB,countC,countD,countF]
def computeAnswers(L):
largest = findLargest(L)
smallest = findSmallest(L)
average = findAverage(L)
gradeCounts = countGrades(totalGrades(L))
return [gradeCounts[0],gradeCounts[1],gradeCounts[2],gradeCounts[3],
gradeCounts[4],len(L),average,largest,smallest]
###this is the part I need help with to make the output####
def main():
...
...
answers = computeAnswers(Scores)
print
print
##The output is SUPPOSED to look like this.
#>>> from Scores import *
#>>> main()
#Enter score (0 to stop): 63
#Enter score (0 to stop): 75
#Enter score (0 to stop): 72
#Enter score (0 to stop): 72
#Enter score (0 to stop): 78
#Enter score (0 to stop): 67
#Enter score (0 to stop): 80
#Enter score (0 to stop): 63
#Enter score (0 to stop): 75
#Enter score (0 to stop): 90
#Enter score (0 to stop): 89
#Enter score (0 to stop): 43
#Enter score (0 to stop): 59
#Enter score (0 to stop): 99
#Enter score (0 to stop): 82
#Enter score (0 to stop): 12
#Enter score (0 to stop): 100
#Enter score (0 to stop): 0
#
#Number of "A" scores = 3
#Number of "B" scores = 3
#Number of "C" scores = 5
#Number of "D" scores = 3
#Number of "F" scores = 3
#-------------------------
#Total Scores = 17
#Average Score = 71.0
#Maximum Score = 100
#Minimum Score = 12