So I've created this dictionary from a tsv file,
import csv
grades = {}
with open('grades.tsv', newline='') as csv_f:
for row in csv.DictReader(csv_f, delimiter='\t'):
fullname = row['#fname'] + ' ' + row['lname']
grades[fullname] = float(row['marks'])
maxgrade = max(grades,key=grades.get)
print(grades)
print(maxgrade)
csv_f.close()
The tsv file looks like this:
#fname lname marks
Alice Brown 8.5
Francine Walters 9
Robert Wilson 7
Evelyn Stewart 10
Margo Kazinsky 9.5
Gordon Rogers 8.5
Stephanie Hoover 9
Roger Brosnan 8.7
Francine Williamson 9
Leonard Runka 8
Rosalind Samuelson 6.5
Sasha Levchenko 8
Anastasia Melnyk 8.5
Charlie Watson 8
After finding the name with the highest grade
- I don't know how to manipulate the values to find the names of all the students whose grades are above the mean for the class. (the mean being the sum of the values divided by the number of values).
- I don't know how to find the median grade of the class.
- And the names of all students whose grades are above the median.