Question 12 2 Points Write Function Named Uniquewords Counts Many Different Words Line Inp Q27561079

Python 3.6

Question 12 (2θ points) Write a function named uniquewords that counts how many different words there are in each line of an input file and writes that count to a corresponding line of an output file. The input file already exists when uniquewords is called. uniquewords creates the output file. Input. The function uniquewords takes two parameters: · inFile, a string that is the name of a text file that is to be read. The file tuact unt ion rarer s oto cont a ins only hover case letters and white space (nco punctuation marks or other special characters) outFile, a string that is the name of the file to which uniquewords writes its output The input file is in the current working directory. uniquewords should create the output file in that directory output. For each line of inFile, uniquewords should write a corresponding line to outFile containing a single integer: the number of unique words on the 1 If the content of the file turn.txt is below, a time to build up a time to break down a time to dance a time to mourn a time to cast away stones a time to gather stones together the function call uniquewords (turn.txt, turnout.txt) should create a file named turnout.txt with this content: 7 5 8

Question 12 (2θ points) Write a function named uniquewords that counts how many different words there are in each line of an input file and writes that count to a corresponding line of an output file. The input file already exists when uniquewords is called. uniquewords creates the output file. Input. The function uniquewords takes two parameters: · inFile, a string that is the name of a text file that is to be read. The file tuact unt ion rarer s oto cont a ins only hover case letters and white space (nco punctuation marks or other special characters) outFile, a string that is the name of the file to which uniquewords writes its output The input file is in the current working directory. uniquewords should create the output file in that directory output. For each line of inFile, uniquewords should write a corresponding line to outFile containing a single integer: the number of unique words on the 1 If the content of the file turn.txt is below, a time to build up a time to break down a time to dance a time to mourn a time to cast away stones a time to gather stones together the function call uniquewords (‘turn.txt’, ‘turnout.txt’) should create a file named turnout.txt with this content: 7 5 8 Show transcribed image text Question 12 (2θ points) Write a function named uniquewords that counts how many different words there are in each line of an input file and writes that count to a corresponding line of an output file. The input file already exists when uniquewords is called. uniquewords creates the output file. Input. The function uniquewords takes two parameters: · inFile, a string that is the name of a text file that is to be read. The file tuact unt ion rarer s oto cont a ins only hover case letters and white space (nco punctuation marks or other special characters) outFile, a string that is the name of the file to which uniquewords writes its output The input file is in the current working directory. uniquewords should create the output file in that directory output. For each line of inFile, uniquewords should write a corresponding line to outFile containing a single integer: the number of unique words on the 1 If the content of the file turn.txt is below, a time to build up a time to break down a time to dance a time to mourn a time to cast away stones a time to gather stones together the function call uniquewords (‘turn.txt’, ‘turnout.txt’) should create a file named turnout.txt with this content: 7 5 8

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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