def readScores(): result = [] # a zero-length array # open 8Scores.txt for input fileName = "8Scores.txt" try: fin = open(fileName) result = [0 for i in range(8)] except: print(fileName, "not found") return result # end the function NOW # read and save the scores for i in range(len(result)): result[i] = int(fin.readline().strip()) fin.close() return result # readScores ends here # main program starts here ... score = readScores()