Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- #Count function
- def count_func(list_element,item_list):
- count = 0
- for item in item_list:
- if list_element == item:
- count += 1
- return count
- scores = [] #creates an empty list
- for x in range (0, 30): #30 studenst
- scores.append(random.randint(0, 10)) #assigns scores to the students
- print(scores)
- top_scorers = count_func(10,scores) #calls the count function to check the number of 10s
- print("{0} learners got top marks".format(top_scorers))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement