Python: How do I add a “Final Grade” converter in my Grading System Calculator
Python: How do I add a “Final Grade” converter in my Grading System Calculator
Not really sure what your question is, but here is a more succinct way of getting the letter grade.
>>> scores = [93, 89, 87, 83, 79, 77, 73, 69, 67, 60, 0]
>>> grades = [A, A-, B+, B, B-, C+, C, C-, D+, D, F]
>>>
>>> def gradeFor(s):
... grade_scores = zip(scores, grades)
... for score, grade in grade_scores:
... if s >= score:
... return grade
>>> gradeFor(87)
B+
>>> gradeFor(89)
A-
>>> gradeFor(88)
B+
>>> gradeFor(67)
D+
>>> gradeFor(72)
C-
>>> gradeFor(40)
F
Also, you can do
if endProgram.lower() in (no, false):