infile=open('/content/drive/MyDrive/data/Kokugo.txt') for line in infile: print(line) infile.close() ------------------------------------------------------ infile=open('/content/drive/MyDrive/data/Kokugo.txt') ninzuu=0 for line in infile: print(line, end='') ninzuu=ninzuu+1 infile.close() print() print(ninzuu) ---------------------------------------------------- infile=open('/content/drive/MyDrive/data/Kokugo.txt') goukei=0 for line in infile: print(line, end='') goukei=goukei+int(line) infile.close() print() print(goukei) ------------------------------------------------------- infile=open('/content/drive/MyDrive/data/Kokugo.txt') ninzuu=0 goukei=0 for line in infile: print(line, end='') ninzuu+=1 goukei+=int(line) infile.close() print() print('ninzuu = ',ninzuu) print('goukei = ',goukei) print('heikin = ',goukei/ninzuu) ---------------------------------------------------- import statistics infile=open('/content/drive/MyDrive/data/Kokugo.txt') tokuten_hyou = infile.readlines() infile.close() tokuten=[int(moji) for moji in tokuten_hyou] print(tokuten) print(len(tokuten)) print(sum(tokuten)) print(statistics.mean(tokuten)) print(statistics.stdev(tokuten))