Last active
April 26, 2021 22:54
-
-
Save herikwebb/92420b7012bedf59720553978df1c53c to your computer and use it in GitHub Desktop.
This file contains hidden or 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()) | |
d['Midterm'] = float(f.readline()) | |
d['Final'] = float(f.readline()) | |
f.close() | |
return d | |
def grades_to_float(grades): | |
grades_list = [] | |
for grade in grades.split(): | |
grades_list.append(float(grade)) | |
return grades_list | |
print(read_grades_file("C:\\Users\\herik\\git\\blah\\gmason.grades")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment