Courses‎ > ‎Intro to CS - Full Year‎ > ‎Spring‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 41: 5/23

posted May 23, 2019, 11:05 AM by JonAlf Dyrland-Weaver
Attached to this post are two files that contains (fake) lists of student names and grades. tests.csv contains test grades while work.csv contains homework grades. Each line has the name of a student followed by the grades. Each piece of data is separated by a comma. For example:
            Han,85,86,85,84,82,88,93,82,93,82
            Han,1,0,1,1,1,1,1,0.5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Write functions to do the following, based on this file:

  • grades
    • Read in the file and return a dictionary where each key is a student's name and the value is a list containing that students grades.
    • Takes a single parameter representing the name of the file to be read
    • The list should contain numbers, not strings.
    • Here is a small example of what the dictionary should look like:
      • { 'Han': [85, 86, 85, 84, 82, 88, 93, 82, 93, 82] }
      • { 'Han': [1, 0, 1, 1, 1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] }
  • averages
    • Takes a dictionary, formatted like the return value from grades, as a parameter
    • Returns a different dictionary where each key is a student's name, and the value is the average of all their grades.
    • For example:
      • { 'Han': 86.0 }
      • { 'Han': 0.76 }
  • full_grade
    • Takes 2 dictionaries created from the average function. One should contain the test averages, the other the homework averages.
    • Returns a dictionary where each key is the name of a student and the value is the grade for that student.
    • 70% of a student's grade comes from their test average, while 30% comes from their homework average.
      • For example, Han has a test average of 86 and a homework average of 0.76, so his grade would be 83
        • .86 * 70 + .76 * 30
    • Example dictionary element:
      • { 'Han': 83 }

IMPORTANT NOTE:
    This assignment does not include questions about html forms, but they will be on the test, so study that as well!

submit this as test5_review
ċ
JonAlf Dyrland-Weaver,
May 23, 2019, 11:05 AM
ċ
JonAlf Dyrland-Weaver,
May 23, 2019, 11:05 AM
Comments