=============================================== ==========================
def updateCourses(self, name = '', hours = 0, grade = ''):
gradeDict = {'A': 4, 'A-': 3.7, 'B+': 3.3, 'B': 3, 'B-': 2.7, 'C+' : 2.3,\
'C': 2, 'C-': 1.7, 'D+': 1.3, 'D': 1, 'D-': 0.7, 'F': 0}
course = {}
course['name'] = name
course['hours'] = hours
course['grade'] = grade
self.courses.add(course)
if not name:
name = input("Enter course number:")
print(name)
if not hours:
hours = int(input("Enter hours for:", name))
print(hours)
if not grade:
grade = input("Enter hours for:", name).upper()
print(grade)
score = gradeDict[grade]
course = (name, hours, grade, score)
self.classList.append(course)
self.totalHours += hours
self.qualityPoints += hours * score
self.GPA = self.qualityPoints / self.totalHours
抱歉,我是新手。它返回“Traceback(最近一次调用最后一次):
File "C:\Users\Abee\Desktop\GCSE\test.py", line 157, in <module>
addCourses(studentList)
File "C:\Users\Abee\Desktop\GCSE\test.py", line 111, in addCourses
Student.updateCourses()
TypeError: updateCourses() missing 1 required positional argument: 'self' thanks for helping me