EMPTY = "" NEWLINE = "\n" PUNCTUATION = "." SPACE = " " # Author: James Tam # Version: December 2, 2021 # Features: Program reads text from file and displays information about each line. # @fileInput(none) # @returns(nothing) # Features: # * Opens the specified text file. # * Reads a line at a time (as a string) from the file # * The string is then added to the list. # # To do: # * There is a bug in this function, what needs to be fixed in the next version students? # Reads whole line and not first sentence. def fileInput(): r = -1 aChar = EMPTY aList = [] inputFile = open("words.txt","r") aLine = inputFile.readline() r = 0 while (aLine != EMPTY): aList.append([]) aList[r].append(aLine) for aChar in aList[r]: print(aChar, end="") aLine = inputFile.readline() r = r + 1 # @start(none) # @returns(nothing) def start(): fileInput() start()