Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- myfile = open('grades.txt','r')
- total_grade = 0
- counter = 0
- print('Here are your grades:')
- for line in myfile:
- contents = line.split(",")
- course = contents[0]
- grade = int(contents[1])
- counter += 1
- total_grade += grade
- print("You got a {} in {}".format(grade, course))
- print('The average grade score is')
- print(round(total_grade / counter))
- myfile.close()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement