Skip to content

Instantly share code, notes, and snippets.

def read_grades_file(filename):
d = {}
f = open(filename, "r")
d['Name'] = f.readline().strip()
d['Projects'] = grades_to_float(f.readline())
d['Homeworks'] = grades_to_float(f.readline())
d['zyBooks'] = grades_to_float(f.readline())
d['Quizzes'] = grades_to_float(f.readline())
def write_to_file(filename, grades):
with open(filename, 'w') as f:
for v in grades.values():
if isinstance(v, list):
blah = ' '.join(str(z) for z in v)
f.write(blah + '\n')
else:
f.write(str(v) + '\n')