Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculate_grade(score, maximum=100):
- """
- This function returns the grade of score.
- score := score in points
- maximum := maximum possible score
- The score are normalized internally to 100.
- """
- score /= maximum
- score *= 100
- print(score)
- grades_100 = {
- 93: "A", 90: "A-",
- 87: "B+", 83: "B", 80: "B-",
- 77: "C+", 73: "C", 70: "C-",
- 67: "D+", 63: "D", 60: "D-",
- }
- for min_score, grade in grades_100.items():
- if score >= min_score:
- return grade
- else:
- return "F"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement