Workout #23: JSON

Oct 9, 2021

In this exercise, you’re analyzing test data in a high school. There’s a scores directory on the filesystem containing a number of files in JSON format. Each file represents the scores for one class. Write a function, print_scores, that takes a directory name as an argument and prints a summary of the student scores it finds.

Your function should print the highest, lowest, and average test scores for each subject in each class. Given two files (9a.json and 9b.json) in the scores directory, we would see the following output:

scores/9a.json
science: min 75, max 97, average 86.4
literature: min 78, max 98, average 83.6
math: min 65, max 100, average 85.0
scores/9b.json
science: min 35, max 95, average 82.0
literature: min 38, max 98, average 72.0
math: min 38, max 100, average 77.0

TRY IT YOURSELF

ANSWER

https://colab.research.google.com/drive/1B7McGu4BeupjBgps5jNb1t_xD8F-e9YX?usp=sharing

--

--

Abish Pius
Abish Pius

Written by Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer

No responses yet