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)

#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"

countA = 0
countB = 0
countC = 0
countD = 0
countF = 0
for i in L:
countA = countA + 1
countB = countB + 1
countC = countC + 1
countD = countD + 1
countF = countF + 1
return [countA,countB,countC,countD,countF]

largest = findLargest(L)
smallest = findSmallest(L)
average = findAverage(L)

###this is the part I need help with to make the output####
def main():
...
...
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

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by spiricn

I guess you can add something like this:
(not sure if you are using py2 or 3, this is 3)

``````Scores = []
while True:
a = int(input("Enter score (0 to stop):"))
if not a:
break
Scores.append(a)``````

I think that should do it.
Didn't test it.

``````def findLargest(L):
largest = L[0]
for x in L[1:]:
if x > largest:
largest = x
return largest

def findSmallest(L):
smallest = L[0]
for x in L[1:]:
if x < smallest:
smallest = x
return smallest

def findAverage(L):
sum = 0.0
for x in L:
sum += x
return sum/len(L)

#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"

countA = 0
countB = 0
countC = 0
countD = 0
countF = 0
for i in L:
countA += 1
countB += 1
countC += 1
countD += 1
countF += 1
return [countA,countB,countC,countD,countF]

print '\nNumber of "A" scores: %d\nNumber of "B" scores: %d' % (scores[0],scores[1])
print 'Number of "C" scores: %d\nNumber of "D" scores: %d' % (scores[2],scores[3])
print 'Number of "F" scores: %d\n------------' % scores[4]

print 'Total scores = ', len(L)
print 'Average score = ', findAverage(L)
print '\nMaximum score = ', findLargest(L)
print 'Minimum score = ', findSmallest(L)

L = []
score = True
while score:
try:
score = int(raw_input("Enter score (0 to stop): "))
except ValueError:
continue

if not score:
break

L.append(score)