bobhig

Untitled

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