Recap: Exam Scores
Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 15 of 60.
Challenge
EasySix students sat three exams, marked out of 40, 60 and 100 (max_marks). In scores each row is a student and each column an exam. Raw marks do not compare, so use percentages. The program reads a mark.
- Turn every score into a percentage of its exam's total, without a loop.
- Print the student (1 to 6) with the highest average percentage, and that average to 1 decimal.
- Print how many percentages are below the mark.
Another class of three, as percentages, with the mark 75:
Its output:
Best student: 2 with 83.2%
Scores under 75%: 3Try it yourself
import numpy as np
# One row per student, one column per exam: exam 1, exam 2, exam 3
scores = np.array([[32, 51, 64],
[28, 42, 95],
[22, 41, 70],
[38, 57, 66],
[25, 44, 58],
[30, 53, 69]])
# The most marks each exam can give
max_marks = np.array([40, 60, 100])
mark = int(input())
# Write your code below
All lessons in Data and Plots
2NumPy Arrays
Creating ArraysShape and SizeRanges of NumbersIndexing and SlicingRecap: Temperature Grid3Array Math
Math on Whole ArraysSummary StatisticsStatistics by AxisBroadcastingBoolean MasksRecap: Exam Scores9Grouping and Cleaning
Counting ValuesGrouping DataSeveral SummariesMissing ValuesRecap: Survey ResultsPractice on your own: Online Python compiler