Skip to content

Commit 8892a71

Browse files
committed
Homework 5.3
1 parent 3e50707 commit 8892a71

File tree

2 files changed

+353
-0
lines changed

2 files changed

+353
-0
lines changed

hw5.3/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Homework 5.3
2+
3+
Who's the easiest grader on campus?
4+
A set of grades are loaded into the grades collection.
5+
6+
The documents look like this:
7+
8+
9+
````
10+
{
11+
"_id" : ObjectId("50b59cd75bed76f46522c392"),
12+
"student_id" : 10,
13+
"class_id" : 5,
14+
"scores" : [
15+
{
16+
"type" : "exam",
17+
"score" : 69.17634380939022
18+
},
19+
{
20+
"type" : "quiz",
21+
"score" : 61.20182926719762
22+
},
23+
{
24+
"type" : "homework",
25+
"score" : 73.3293624199466
26+
},
27+
{
28+
"type" : "homework",
29+
"score" : 15.206314042622903
30+
},
31+
{
32+
"type" : "homework",
33+
"score" : 36.75297723087603
34+
},
35+
{
36+
"type" : "homework",
37+
"score" : 64.42913107330241
38+
}
39+
]
40+
}
41+
````
42+
43+
There are documents for each student (student_id) across a variety of classes (class_id). Note that not all students in the same class have the same exact number of assessments. Some students have three homework assignments, etc.
44+
45+
Your task is to calculate the class with the best average student performance. This involves calculating an average for each student in each class of all non-quiz assessments and then averaging those numbers to get a class average. To be clear, each student's average includes only exams and homework grades. Don't include their quiz scores in the calculation.
46+
47+
What is the class_id which has the highest average student performance?
48+
49+
Hint/Strategy: You need to group twice to solve this problem. You must figure out the GPA that each student has achieved in a class and then average those numbers to get a class average. After that, you just need to sort. The class with the lowest average is the class with class_id=2. Those students achieved a class average of 37.6
50+
51+
If you prefer, you may download the handout and perform your analysis on your machine with
52+
53+
````
54+
mongoimport -d test -c grades --drop grades.json
55+
````
56+
57+
* 8
58+
* 9
59+
* 1
60+
* 5
61+
* 7
62+
* 0
63+
* 6
64+
65+
### Response
66+
67+
````
68+
69+
````
70+
71+
*
72+
73+

0 commit comments

Comments
 (0)