Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- def getScores():
- scores = []
- for i in range(0,30):
- score = randint(1,10)
- scores.append(score)
- return scores
- def countStat(scores,stat):
- count = 0
- for score in scores:
- if score == stat:
- count += 1
- return count
- def getStats(scores):
- stats = []
- for stat in range(1,11):
- count = countStat(scores,stat)
- stats.append(count)
- return stats
- def printStats(stats):
- score = 1
- for stat in stats:
- print(str(stat) + " leaners achieved a score of " + str(score))
- score = score + 1
- scores = getScores()
- stats = getStats(scores)
- print(scores)
- printStats(stats)
Add Comment
Please, Sign In to add comment