import?numpy?as?np
with?open(r"C:\Users\Administrator\Desktop\grade.txt","r")?as?f:?
row?=?[]#行號
values?=?[]?#成績
max_g?=?[]?#最好成績的行號
bjg_g?=?[]
for?num,value?in?enumerate(f):
row.append(num)
values.append(int(value.strip('\n')))
group?=?[row,?values]
sum_n?=?sum(values)?#總成績
average_n?=?np.min(values)?#平均成績
max_n?=?max(values)?#最好成績
for?index?in?range(len(values)):
if?values[index]?==?max_n:
max_g.append(index+1)
if?values[index]?<?60:
bjg_g.append(index+1)
print('成績總和:'+str(sum_n))
print("平均成績:"+str(average_n))
print("成績最好的行號:",end='')
print(max_g)
print("成績不及格的行號:",end='')
print(bjg_g)