timpin

Untitled

Aug 29th, 2019
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import random
  2.  
  3. def count(n, scores):
  4. c = 0
  5. for r in scores:
  6. if scores[r] == n:
  7. c +=1
  8. return c
  9.  
  10. scores = []
  11.  
  12. for x in range (0, 30):
  13. scores.append(random.randint(0, 10))
  14.  
  15. print(scores)
  16.  
  17. top_scorers = count(10, scores) # Count function called here
  18. nil_scores = count(0, scores)
  19.  
  20. print("{0} learners got no marks".format(nil_scores))
  21. print("{0} learners got top marks".format(top_scorers))
Add Comment
Please, Sign In to add comment