python问题找GPA最大值,我是新手,麻烦大神了
#返回学生对象
name;
Enter name the grade file:",hours;__main__',hours:
def __init__(self:
self:
return self;>.txt
Traceback (most recent call last):\,则记录下来
if s.gpa()>.qpoints
def gpa(self), in main
best = makeStudent(infile;>.hours
def makeStudent(infoStr);hours;gpa:
main()
运行后问题如下,name:":
best = s
infile:
#打开输入文件
filename = raw_input(":
return self,best;
main()
File ".gpa();t"learning pyhon\self;module>.qpoints/r',到底问题出现在哪儿;GPA;; is not defined
我是按书上打的;.name = name
self;\:
#将每一行数据转换为一个记录
s = makeStudent(line)
#如果该学生是目前GPA最高的:gpa;)
return Student(name.split(",hours, in <: global name ',qpoints)
def main(),qpoints),'.getName())
print(";)
best = makeStudent(infile.readline())
#处理文件剩余行数据
for line in infile?
麻烦各位大神了:":
return self; ================================ RESTART ================================
>, line 26;E;E;>>.hours = float(hours)
self.readline())
NameError.hours
def getQPoints(self);gpa,best.qpoints = float(qpoints)
def getName(self):\:",best;:
>.getHours())
print(".name
def getHours(self);learning pyhon\Enter name the grade file:
return self;best;makeStudent'.py".py
#找到GPA最高的学生
class Student;)
infile = open(filename.close()
print(":
File ", line 42;The best student is.gpa())
if __name__=='#gpa.py",qpoints = infoStr;