Menu

[Solved]-Question 13 20 Points Write Function Named Linestats Function Linestats Takes Three Parame Q37276655

PLEASE HELP #13 IN PYTHON

Question 13 (20 points) Write a function named LineStats. The function LineStats takes three parameters: inFile, a string tha

Question 13 (20 points) Write a function named LineStats. The function LineStats takes three parameters: inFile, a string that is the name of an input file outFile, a string that is the name of an output file threshold, an int that is the length above which a word is considered significant 1. 2. 3. The function lineStats should read and analyze each line of the input file and write two statistics separated by a space, about the line to a corresponding line of the output file. The two statistics for each line are: 1. 2. the number of words the number of distinct significant words (that is, words longer than threshold) Hint: if a word occurs more than once on a line it counts as a single word. Upper and lower case characters are considered the same (‘Word’ and ‘word’ are the same word). The input file contains only upper and lower case letters and white space. For example, if the file fish.txt contains the following lines: Yes some are red and some are blue Some are old and some are new Then the function call lineStats(‘fish.txt’, ‘fishout.txt’, 3) should produce an output file fishOut. txt with the following content: 8 2 Show transcribed image text Question 13 (20 points) Write a function named LineStats. The function LineStats takes three parameters: inFile, a string that is the name of an input file outFile, a string that is the name of an output file threshold, an int that is the length above which a word is considered significant 1. 2. 3. The function lineStats should read and analyze each line of the input file and write two statistics separated by a space, about the line to a corresponding line of the output file. The two statistics for each line are: 1. 2. the number of words the number of distinct significant words (that is, words longer than threshold) Hint: if a word occurs more than once on a line it counts as a single word. Upper and lower case characters are considered the same (‘Word’ and ‘word’ are the same word). The input file contains only upper and lower case letters and white space. For example, if the file fish.txt contains the following lines: Yes some are red and some are blue Some are old and some are new Then the function call lineStats(‘fish.txt’, ‘fishout.txt’, 3) should produce an output file fishOut. txt with the following content: 8 2

Expert Answer


Answer to Question 13 (20 points) Write a function named LineStats. The function LineStats takes three parameters: inFile, a strin… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *