CambridgeEngineering/PartIA-Computing-Michaelmas

Typo error in Exercise 07.2?

Closed this issue · 1 comments

Should

A function that takes a NumPy array of the raw scores and returns the scores as a percentage sorted from lowest to highest (try using scores.sort(), where scores is an Numpy array).

instead read

A function that takes a NumPy array of the raw scores and returns the scores as a percentage sorted from lowest to highest (try using numpy.sort()).

scores.sort() does not seem to work but numpy.sort() does.

sort() is a member function, so it should be called on the array object. Here's an example:

import numpy as np
scores = np.array([20.6, 13.8, 98.8, 68.2])
scores.sort()
print(scores)

[ 13.8  20.6  68.2  98.8]