Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Plot
- import matplotlib.pyplot as plot
- # performance = [2,0,2,3,2,4,5,3,2,4,3]
- from random import randint
- def count(scores):
- tens = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- for x in range(11):
- for score in scores:
- if score == x:
- tens[x] += 1
- return(tens)
- scores = []
- for i in range(0, 30):
- scores.append(randint(0,10))
- top_scorers = count(scores)
- print(top_scorers, " learners got top marks")
- plot.bar(range(11), top_scorers, align='center', alpha=0.5)
- plot.xticks(range(11))
- plot.ylabel('Score frequency')
- plot.title('Scores on a quiz')
- plot.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement