Nov-23-2019, 02:53 PM
(Nov-22-2019, 11:33 PM)scidam Wrote: You need to clarify what means "the student progresses" in terms of column values. Honestly, I don't understand what does it mean, probably, student's progress implies that values in the second column of the array are greater corresponding values in its third column.
If so, you can write this condition easily:results[:, <appropriate column selector1>] > results[:, <appropriate column selector2>]
. That would be a one-line solution which you are looking for. The third part of the assignment likely assumes that you solved the second one. Given a Boolean mask, e.g. mask = np.array([True, True, False, False]), you can donames[mask]
andresults[mask]
. It is highly recommended to look into NumPy tutorial.
A student progresses to the next year if they have an average of 40% or more (the first column of numbers gives the average score for each student) and they have no hard-fails (the last column gives this info - only Bob has a hard fail).