# Get Stats

Apr 25th, 2021
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from random import randint
2.
3. def getScores(numberOfScores):
4.     scores = []
5.     for i in range(0,numberOfScores):
6.         score = randint(1,10)
7.         scores.append(score)
8.     return scores
9.
10. def getMaximum(scores):
11.     maximum = -1
12.     for score in scores:
13.         if score > maximum:
14.             maximum = score
15.     return maximum
16.
17. def getMinimum(scores):
18.     minimum = -1
19.     for score in scores:
20.         if score < minimum or minimum == -1:
21.             minimum = score
22.     return minimum
23.
24. def getMeanScore(scores):
25.     total = 0
26.     for score in scores:
27.         total = total + score
28.     return float(total/len(scores))
29.
30. numberOfScores = 10
31. scores = getScores(numberOfScores)
32. print(scores)
33. print("Maximum Score {}".format(getMaximum(scores)))
34. print("Minimum Score {}".format(getMinimum(scores)))
35. print("Mean Score {}".format(getMeanScore(scores)))
36.