Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- #list stores randomly generated scores and length sets number of scores to generate
- scores = []
- length = int(input("Number of scores:"))
- #creates dataset and appends to scores list
- def data_set(size):
- for x in range(size):
- values = randint(0, 10)
- scores.append(values)
- #calls dataset function based on specified length and calculates corresponding mean
- def mean(dataset):
- data_set(length)
- total = 0
- for i in dataset:
- total += i
- avg = total/length
- return avg
- #calls mean function with scores list and prints mean and dataset for inspection
- average = mean(scores)
- print("The mean score is:" + str(average))
- print(scores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement