0

Instructions: Your function should be called grade. Your input will be an array where each rows shows the score of a student. Your output will be an array WITH THE EXACT SAME SIZE as the input array, but only filled with 'P' and 'F'.

If the score is >= 70, then for that test, the student passes. We give the symbol 'P' to indicate that the student passes. If the score is < 70, then for that test, the student fails. We give the symbol 'F', to indicate that the student fails. Example 1:

input_array = np.array([[80,50,80,60,70],
                   [100,90,80,70,50],
                   [70,70,60,50,85]])
input_array
array([[ 80,  50,  80,  60,  70],
   [100,  90,  80,  70,  50],
   [ 70,  70,  60,  50,  85]])

If the input is like the above array, then it means we have 3 students. Each student has 5 scores.

The first student's scores are: 80, 50, 80, 60, 70. From first to last, the student Pass, Fail, Pass, Fail, Pass The second student's scores are: 100, 90, 80, 70, 50. From first to last, the student Pass, Pass, Pass, Pass, Fail The third student's scores are: 70, 70, 60, 50, 80. From first to last, the student Pass, Pass, Fail, Fail, Pass Then, when you do grade(input_array), your output should be like this: [[P,F,P,F,P],[P,P,P,P,F],[P,P,F,F,P]]

0 Answers0