Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

GPA calculator - Python Code Bank


GPA calculator
calculates as many grades as you want all you have to do is enter you letter grades a-f suports both + and -. made with help from ynori7.
                num = int(raw_input("how many grades grades are you entering "))

gradeChart = { 'a+':4.0,'a':4.0,'a-':3.7,'b+':3.3,'b':3.0,'b-':2.7,'c+':2.3,
           'c':2.0,'c-':1.7,'d+':1.3,'d':1.0,'f':0.0}

total=0

for x in range(num):
    grades =raw_input("Enter your grades to calculate your GPA ")
    total+=gradeChart[grades]

a=['a', 'a-', 'b+', 'b', 'b-', 'c+', 'c', 'c-', 'd+', 'd', 'd-', 'f']


finalGrade=total/num

for x in a:
    if finalGrade>=gradeChart[x]:
        print x
        break

# Made by fallingmidget and ynori7
            
Comments
ghost's avatar
ghost 15 years ago

… Meh. Solid code, but it's more damn math. I had more fun with Python when I coded in it; waiting to see some of those same experiences here.