I graduated! Click here to see some of my favorite papers I wrote during my undergrad
I was dissatisfied with a lot of the Cumulative GPA calculators I was finding online so I wrote my own in Python3.
This embedded script works much better on desktop than mobile.
The source code for the project:
# weighted GPA calculator
import sys
# For color printing
GREEN = "\033[0;92m"
RED = "\033[1;31m"
RESET = "\033[0;0m"
blankline = ""
# from bulletin.georgetown.edu/regulations/studying/#QualityGrades
georgetown_qpoints = {
"A": 4.00,
"A-": 3.67,
"B+": 3.33,
"B": 3.00,
"B-": 2.67,
"C+": 2.33,
"C": 2.00,
"C-": 1.67,
"D+": 1.33,
"D": 1.00,
"F": 0.00
}
# Welcome Message
print("To calculate cumulative GPA you will need the following information:")
print("• Current GPA\n• Current Total Credit Hours")
print("On your transcript these numbers are at the very bottom and labeled GPA and QHrs\n")
# Collect Current Data
print(f"{RED}Please enter the following as digits (e.g. 3 or 3.5){RESET}")
current_gpa = float(input("Current GPA? > "))
current_creds = float(input("Current Number of Credit Hours? > "))
current_grade_points = current_gpa * current_creds
num_new_classes = int(input("How many classes would you like to add? > "))
if num_new_classes == 0:
print("Your GPA will not change if you do not add classes. Program Quitting...")
sys.exit()
# Collect New Course Data
new_class_grades = []
new_class_credits = []
print(blankline)
for i in range(num_new_classes):
new_class_grades.append(input(f"{RED}Letter grade for new class {i+1}? > {RESET}"))
new_class_credits.append(float(input(f"{RED}Credit hours for new class {i+1}? > {RESET}")))
# Calculate Weighted Grades: (QP * CreditHrs)
weighted_grades = []
for grade, credits in zip(new_class_grades, new_class_credits):
qpoints = georgetown_qpoints[grade.upper()]
weighted_grades.append(credits * qpoints)
# Sum new Values
new_num_creds = current_creds + sum(new_class_credits)
new_num_grade_points = current_grade_points + sum(weighted_grades)
# Calculate new Cumulative GPA
new_weighted_gpa = new_num_grade_points / new_num_creds
# Print Output
print(f"\nYour old weighted GPA was: {current_gpa}")
amnt_change = new_weighted_gpa - current_gpa
if amnt_change > 0:
print(f"Your new weighted GPA is: {GREEN}{new_weighted_gpa}{RESET}")
print(f"That's a difference of {GREEN}{new_weighted_gpa - current_gpa}{RESET}")
elif amnt_change < 0:
print(f"Your new weighted GPA is: {RED}{new_weighted_gpa}{RESET}")
print(f"That's a difference of {RED}{new_weighted_gpa - current_gpa}{RESET}")
print("\n-----")
print("\nDetails:")
print(f"Your old stats:\n\tCredit Hours: {current_creds}",
f"\n\tQuality Points: {current_grade_points}",
f"\n\tGPA: {current_gpa} (Quality Points/ Credit Hours)\n")
print("You added the following Classes:")
for i, course in enumerate(list(zip(new_class_grades, new_class_credits))):
grade, credit = course
print(f"\tNew Class #{i+1}:")
print(f"\t\tGrade: {grade.upper()}")
print(f"\t\tQuality Points: {georgetown_qpoints[grade.upper()]}")
print(f"\t\tCredits: {credit}")
print(f"\nYour new stats:\n\tCredit Hours: {new_num_creds}",
f"\n\tQuality Points: {new_num_grade_points}",
f"\n\tGPA: {new_weighted_gpa} (Quality Points/ Credit Hours)")
print("\nThanks for using this program! Goodbye\n\n")