So what I'm trying to do is get the sum of quality points ("qp")
Code:
a=raw_input('Enter the number of courses you are taking: ')
print("")
print("")
b=int(a)
c=range(b)
if int(a) <= 0:
print ('Error: You must have at least one class!')
d=('Enter the course *NAME*, *CREDITS*, and *GRADE*: ')
for i in range(b):
locals()["y"+str(i)]=raw_input(d).split(',')
locals()["p"+str(i)]=locals()["y"+str(i)][2]
locals()["c"+str(i)]=locals()["y"+str(i)][1]
print("")
for i in c:
if locals()["p"+str(i)]=='a':
locals()["qp"+str(i)]=4
elif locals()["p"+str(i)]=='b':
locals()["qp"+str(i)]=3
elif locals()["p"+str(i)]=='c':
locals()["qp"+str(i)]=2
elif locals()["p"+str(i)]=='d':
locals()["qp"+str(i)]=1
elif locals()["p"+str(i)]=='u':
locals()["qp"+str(i)]=0
else:
print("You entered an incorrect grade!")
print("")
print("")
for i in c:
gradesum=int(locals()["qp"+str(i)])
k2=sum(gradesum)
print k2
gpa= "dont know yet"
print("Your GPA is calculated to be: "+gpa)
Comment