Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- scores = []
- for x in range (0, 30):
- scores.append(random.randint(0, 10))
- def count(threshold, scores):
- top_scores = []
- for i in scores:
- if i >= threshold:
- top_scores.append(i)
- count = len(top_scores)
- return count
- def countSpecific(specific, scores):
- specificCount = []
- for i in scores:
- if i == specific:
- specificCount.append(i)
- count = len(specificCount)
- return count
- print(scores)
- print("{0} learners got top marks".format(count(10, scores)))
- print("{0} learners got a 7".format(countSpecific(7, scores)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement