Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from random import randint
- def count_high(result, test): # Count function defined with 2 arguments.
- count = 0
- for score in test:
- if score == result:
- count += 1
- return count
- def count_low(result, test): # Count function defined with 2 arguments.
- count = 0
- for score in test:
- if score <= result:
- count += 1
- return count
- scores = []
- for x in range(0, 30):
- scores.append(random.randint(0, 10))
- print(scores)
- top_scores = count_high(10, scores) # Count function called here
- bottom_scores = count_low(3, scores)
- print("{0} learners got top marks".format(top_scores))
- print("{0} learners got low marks".format(bottom_scores))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement