Advertisement
elena_gancedo

Levels_count

Aug 29th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. print ("************************************************")
  2. import random
  3. # Add your count function here
  4. def count(value, list):
  5.     num = 0
  6.     for i in list:
  7.         if i == value:
  8.             num += 1
  9.     return num
  10. #
  11. scores = []
  12. for x in range (0, 30):
  13.   scores.append(random.randint(0, 10))
  14. print("Scores: ", scores)
  15. top_scorers = count(10, scores) # Count function called here
  16. print("{0} learners got top marks".format(top_scorers))
  17. print ("************************************************")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement