subject
Engineering, 10.11.2019 03:31 Hellopeople233

Pyhtonwrite a function named repeatwords() that takes two string parameters: 1. the name of an input file that exists before repeatwords() is called2. the name of an output file that repeatwords() createsassume that the input file is in the current working directory and write the output file to that directory. for each line of the input file, the function repeatwords() should write to the output file all of the words that appear more than once on that line. each word should be lower cased and stripped of leading and trailing punctuation. each repeated word on a line should be written to the corresponding line of the output file only once, regardless of the number of times the word is repeated. for example, if the following is the content of the file catinthehat. txt: too wet to go out and too cold to play ball. so we sat in the house. we did nothing at all. so all we could do was to sit! sit! sit! sit! the following function call: inf = 'catinthehat. txt'outf = 'catrepwords. txt'repeatwords(inf, outf)should create the file ‘catrepwords. txt’ with the content: too tosithint: for each line, create a list of repeated words and then write the list (without repetition) to the outfile. be sure to test your solution with input in which some repeated words on a line are a mixture of upper and lower case, and in which repeated words sometimes are preceded or followed by punctuation

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
question
Engineering, 04.07.2019 18:10
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
Answers: 2
question
Engineering, 04.07.2019 18:10
Which of the following components of a pid controlled accumulates the error over time and responds to system error after the error has been accumulated? a)- proportional b)- derivative c)- integral d)- on/off.
Answers: 2
You know the right answer?
Pyhtonwrite a function named repeatwords() that takes two string parameters: 1. the name of an input...
Questions
question
Mathematics, 27.01.2021 19:10
question
Mathematics, 27.01.2021 19:10
question
Mathematics, 27.01.2021 19:10
question
Mathematics, 27.01.2021 19:10
question
Social Studies, 27.01.2021 19:10
Questions on the website: 13722362