Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Name: module2
- # Purpose:
- #
- # Author: DGarey
- #
- # Created: 12/01/2020
- # Copyright: (c) DGarey 2020
- # Licence: <your licence>
- #-------------------------------------------------------------------------------
- import random
- #
- # Add your count function here
- def count(number, list):
- count = 0 # Initialise a variable for counting scores of ten
- for item in list:
- if item == number:
- count += 1
- return(count)
- #
- scores = []
- for x in range (0, 30):
- scores.append(random.randint(0, 10))
- print(scores)
- top_scorers = count(10, scores) # Count function called here
- print(str(top_scorers) + " learners got top marks")
- mean_scores = sum(scores)/len(scores)
- min_scores = min(scores)
- max_scores = max(scores)
- print("Average =", mean_scores, " minimum score = ", min_scores, " maximum score = ", max_scores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement