Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- def getScores(numberOfScores):
- scores = []
- for i in range(0,numberOfScores):
- score = randint(1,10)
- scores.append(score)
- return scores
- def getMaximum(scores):
- maximum = -1
- for score in scores:
- if score > maximum:
- maximum = score
- return maximum
- def getMinimum(scores):
- minimum = -1
- for score in scores:
- if score < minimum or minimum == -1:
- minimum = score
- return minimum
- def getMeanScore(scores):
- total = 0
- for score in scores:
- total = total + score
- return float(total/len(scores))
- numberOfScores = 10
- scores = getScores(numberOfScores)
- print(scores)
- print("Maximum Score {}".format(getMaximum(scores)))
- print("Minimum Score {}".format(getMinimum(scores)))
- print("Mean Score {}".format(getMeanScore(scores)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement