Advertisement
rickzman

Untitled

Dec 13th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. # Plot
  2. import matplotlib.pyplot as plot
  3.  
  4. # performance = [2,0,2,3,2,4,5,3,2,4,3]
  5. from random import randint
  6.  
  7. def count(scores):
  8. tens = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  9. for x in range(11):
  10. for score in scores:
  11. if score == x:
  12. tens[x] += 1
  13. return(tens)
  14.  
  15. scores = []
  16. for i in range(0, 30):
  17. scores.append(randint(0,10))
  18.  
  19. top_scorers = count(scores)
  20. print(top_scorers, " learners got top marks")
  21.  
  22.  
  23.  
  24. plot.bar(range(11), top_scorers, align='center', alpha=0.5)
  25.  
  26. plot.xticks(range(11))
  27. plot.ylabel('Score frequency')
  28. plot.title('Scores on a quiz')
  29.  
  30. plot.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement