Lesson goal: Data Science: Class grades

Previous: Mining geographic data | Home | Next: Introduction to Prolog,Part I: facts and goals

Here's a common data science exercise: working with student names and class grades. A file called grades.csv contains 500 lines. Each line is in this format: last,first,grade. All grades are between 0 and 100. (All names and grades are fake.)

Here are some challenges for you:

  • Print each last,first name and a letter grade, given that: < 60 is an F, 60-69 is a D, 70-79 is a C, 80-89 is a B, and 90 or above is an A.

  • How many As, Bs, Cs, Ds, and Fs did the class end up with (Ans: 84, 203, 154,41, 8.)

  • What was the average grade? (Ans: 73).

  • What is the class GPA if A=4.0, B=3.0, C=2.0, D=1.0, F=0? (Ans: 1.70)

  • For the "Dean's List," print just students who got an "A."

  • For the "academic probation list," print just students who got a "D" or "F."

  • Who got the highest grade? Or were there more than one with the highest?

Now you try. Run some data science on these grades.

Type your code here:

See your results here: