Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import random
  2.  
  3. def countscores(list, score):
  4. countstore = 0
  5. for item in list:
  6. if item == score:
  7. countstore += 1
  8. return countstore
  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 = countscores(scores, 10) # Count function called here
  18.  
  19. print("{0} learners got top marks".format(top_scorers))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement