Menu
CoddyTech

Recap: Exam Scores

Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 15 of 60.

challenge icon

Challenge

Easy

Six 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.

  1. Turn every score into a percentage of its exam's total, without a loop.
  2. Print the student (1 to 6) with the highest average percentage, and that average to 1 decimal.
  3. Print how many percentages are below the mark.

Another class of three, as percentages, with the mark 75:

Another class of 3 students as percentages of each exam's total: 65, 75, 68; 87.5, 80, 82; 77.5, 65, 77. The three scores under 75% are shaded, and so is the best average, student 2's 83.2%

Its output:

Best student: 2 with 83.2%
Scores under 75%: 3

Try 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

Practice on your own: Online Python compiler