Write a function average_unit_grade(unit_name, results) that accepts as input a unit name and a table of study results
of various students and units and that returns as output the average grade of the given unit. The input table is expected
to contain three columns: unit, student ID, grade. You can assume that there is at least one result for the input unit
name.
For example:
>>> results =[ 'Database', 101028, 65],
['Database', 101022, 80],
['Operating Systems', 493968, 68],
['Operating Systems', 201022, 59],
['Java Fundamentals', 493968, 45],
['Java Fundamentals', 101022, 85],
['Mathematics', 101022, 71],
['Mathematics', 493968, 67],
['Information Systems', 493968, 75]]72.569.0
Note: Your solution may NOT use any imports.
Write a function average_unit_grade(unit_name, resu1ts) that accepts as input a unit name and a table of study results of various students and units and that returns as output the average grade of the given unit. The input table is expected to contain three columns: unit, student ID, grade. You can assume that there is at least one result for the input unit name.
For example:
>>>results=[['Database',101028,65]
['Database', 101022, 80],
['Operating Systems', 493968, 68]
['Operating Systems', 201022, 59]
['Java Fundamentals', 493968, 45]
['Java Fundamentals',101022, 85]
['Mathematics', 101022, 71],
['Mathematics', 493968, 67]
['Information Systems', 493968, 75]
>>> average_unit_grade('Database', results)
72.5
>>>average_unit_grade('Mathematics',results)
69.0
Note: Your solution may NOT use any imports