Traceback (most recent call last):
File "C:\Users\user\Desktop\T5.py", line 12, in
f_score = int(int(L1[1])*0.4+int(L1[2])*0.6)
IndexError: list index out of range
f = open("score1.txt",encoding='gb18030', errors='ignore')
a = f.readlines()
del a[0]
L3=[]
for line in a:
line=line.strip()
L1=line.split()
f_score=int(int(L1[1])*0.4+int(L1[2])*0.6)
L3.append([L1[0],f_score])
f.close()
c=[0,0,0,0]
count=0
sum=0
f2 = open("score2.txt",'w')
f2.write("学号 平均成绩\n");
for L2 in L3:
if 90<f_score <=100:
c[0] += 1
elif f_score >=80:
c[1] += 1
elif f_score >=70:
c[2] += 1
elif f_score >=60:
c[3] += 1
else :
c[4] += 1
count += 1
sum+=L2[1]
f2.write(L2[0]+""+str(L2[1])+"\n")
f2.close()
avg_score = int(sum/count)
print("学生总人数为%d,按总评成绩计,90以上%d人,80-90有%d人,70-80有%d人,60-70有%d人,60以下有%d人,班级总平均分%d分。"%d(count,c[0],c[1],c[2],c[3],c[4],avg_score))
```![图片说明](https://img-ask.csdn.net/upload/201911/01/1572577817_983256.png)