我正在尝试为用户的加权GPA创建一个计算器。我正在使用PyautoGUI向用户询问他们的成绩和班级类型。但我希望能够获取用户输入并基本上将其重新映射到不同的值。
class GPA():
grades = []
classtypes = []
your_format = confirm(text='Choose your grade format: ', title='',
buttons=['LETTERS', 'PERCENTAGE', 'QUIT'])
classnum = int(prompt("Enter the number of classes you have: "))
for i in range(classnum):
grade = prompt(text='Enter your grade for the course
:'.format(name)).lower()
classtype = prompt(text='Enter the type of Course (Ex. Regular, AP, Honors): ').lower()
classtypes.append(classtype)
grades.append(grade)
def __init__(self):
self.gradeMap = {'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}
self.weightMap = {'advanced placement': 1.0, 'ap': 1.0, 'honors': 0.5,'regular': 0.0}