""" Author: James Tam Version: March 22, 2018 Reads the name information from file and stores in a list """ SIZE = 100 def display(list,numElements): i = 0 j = 1 while (i < numElements): print("Person %d: %s" %((i+1),list[i])) if (j == 20): input("Hit enter to continue") j = 1 i = i + 1 j = j + 1 def readFromFile(): list = [] numElements = 0 fileName = input("Name of data file: ") inputFile = open(fileName,"r") for line in inputFile: name,phone = line.split(",") list.append(name) numElements = numElements + 1 inputFile.close() return(list,numElements) def writeToFile(list,numElements): i = 0 outputFile = open("names.txt","w") print("Writing results to 'names.txt'") while (i < numElements): temp = list[i] + "\n" + "***" + "\n\n" outputFile.write(temp) i = i + 1 outputFile.close() def start(): list,numElements = readFromFile() display(list,numElements) writeToFile(list,numElements) start()