This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |