Anonymised scores (out of 60) for an examination are stored in a NumPy array. Write: A function that takes a NumPy array of the raw scores and returns the scores as percentages, sorted from lowest to highest (try using scores.sort(), where scores is a NumPy array holding the scores). A function that returns the maximum, minimum and mean of the raw scores as a dictionary with the keys 'min', 'max' and 'mean'. Use the NumPy array functions min(), max() and mean() to do the computation, e.g. max = scores.max(). Design your function for the min, max and mean to optionally exclude the highest and lowest scores from the computation of the min, max and mean. Hint: sort the array of scores and use array slicing to exclude the first and the last entries. Use the scores scores = np.array([58.0, 35.0, 24.0, 42, 7.8]) to test your functions.
def to_percentage_and_sort(scores): # YOUR CODE HERE raise NotImplementedError() def statistics(scores, exclude=False): # YOUR CODE HERE raise NotImplementedError()
# YOUR CODE HERE
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)